In rescanNetwork(), there are two calls of newAJAXCommand(). The first one “newAJAXCommand(‘scan.cgi?scan=1’);” The second one is “setTimeout(“newAJAXCommand(‘status.xml’, updateStatus, false)”, 50)”
The content of scan.cgi is kind of “Success! scan”. My questions are:
Per my understanding, scan.cgi must be a CGI script written in Perl, Python, or another scripting language. “Success! scan” doesn’t look like a script of any language. How come? What does it mean?
What is this call “newAJAXCommand(‘status.xml’, updateStatus, false)” for? where ‘updateStatus’ is a JavaScript function as below.
In “newAJAXCommand”, once “newAjax.ajaxReq.send(data);” is executed, the server side associated function must be called, but I found no function was called. How can I find the missing place?
// Initiates a new AJAX command
// url: the url to access
// container: the document ID to fill, or a function to call with response XML (optional)
// repeat: true to repeat this call indefinitely (optional)
// data: an URL encoded string to be submitted as POST data (optional)
function newAJAXCommand(url, container, repeat, data)
{
// Set up our object
var newAjax = new Object();
var theTimer = new Date();
newAjax.url = url;
newAjax.container = container;
newAjax.repeat = repeat;
newAjax.ajaxReq = null;
// Create and send the request
if (window.XMLHttpRequest) {
newAjax.ajaxReq = new XMLHttpRequest();
newAjax.ajaxReq.open((data==null)?"GET":"POST", newAjax.url, true);
newAjax.ajaxReq.send(data);
// If we're using IE6 style (maybe 5.5 compatible too)
} else if (window.ActiveXObject) {
newAjax.ajaxReq = new ActiveXObject("Microsoft.XMLHTTP");
if (newAjax.ajaxReq) {
newAjax.ajaxReq.open((data==null)?"GET":"POST", newAjax.url, true);
newAjax.ajaxReq.send(data);
}
}
newAjax.lastCalled = theTimer.getTime();
// Store in our array
ajaxList.push(newAjax);
}
.......
function updateStatus(xmlData)
{
......
}
.....
function rescanNetwork()
{
scanDots = 0;
printButtonName();
document.getElementById("rescan").disabled = true;
// Generate a request to hardware to issue a rescan
newAJAXCommand('scan.cgi?scan=1');
// Delete old table, replace with new table after scan is finished
deleteScanTable();
currBss = 0; // Reset the current bss pointer
setTimeout("newAJAXCommand('status.xml', updateStatus, false)", 50);
}
// url: the url to access
// container: the document ID to fill, or a function to call with response XML (optional)
// repeat: true to repeat this call indefinitely (optional)
// data: an URL encoded string to be submitted as POST data (optional)
function newAJAXCommand(url, container, repeat, data)
{
// Set up our object
var newAjax = new Object();
var theTimer = new Date();
newAjax.url = url;
newAjax.container = container;
newAjax.repeat = repeat;
newAjax.ajaxReq = null;
// Create and send the request
if (window.XMLHttpRequest) {
newAjax.ajaxReq = new XMLHttpRequest();
newAjax.ajaxReq.open((data==null)?"GET":"POST", newAjax.url, true);
newAjax.ajaxReq.send(data);
// If we're using IE6 style (maybe 5.5 compatible too)
} else if (window.ActiveXObject) {
newAjax.ajaxReq = new ActiveXObject("Microsoft.XMLHTTP");
if (newAjax.ajaxReq) {
newAjax.ajaxReq.open((data==null)?"GET":"POST", newAjax.url, true);
newAjax.ajaxReq.send(data);
}
}
newAjax.lastCalled = theTimer.getTime();
// Store in our array
ajaxList.push(newAjax);
}
.......
function updateStatus(xmlData)
{
......
}
.....
function rescanNetwork()
{
scanDots = 0;
printButtonName();
document.getElementById("rescan").disabled = true;
// Generate a request to hardware to issue a rescan
newAJAXCommand('scan.cgi?scan=1');
// Delete old table, replace with new table after scan is finished
deleteScanTable();
currBss = 0; // Reset the current bss pointer
setTimeout("newAJAXCommand('status.xml', updateStatus, false)", 50);
}