How To Invoke Three Ajax Functions Together?
Below is the code in my asp page Ajax.asp Ajax.asp
Solution 1:
I can't really see where your problem is, so it must be in your asp page. I'm sorry to say that I can't have a way of testing asp at the moment, so I can't help there. but, I wrote a fake delay in PHP and run your javascript. Here's what I used to test:
<?if (isset($_GET['SECOND'])) {
for($i=0;$i<$_GET['SECOND']*100000;$i++) {
$x = sqrt($i);
}
echo$_GET['SECOND'].': x='.$x;
die();
}
?><html><head><metahttp-equiv="Content-Type"content="text/html; charset=windows-1252"><title>Ajax.asp</title><scripttype="text/javascript">functionDelay(SECOND)
{
var xmlHttp;
try
{
xmlHttp=newXMLHttpRequest(); }
catch (e)
{
try
{
xmlHttp=newActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
try
{
xmlHttp=newActiveXObject("Microsoft.XMLHTTP");
}
catch (e)
{
alert("Your browser does not support AJAX!");
returnfalse;
}
}
}
xmlHttp.onreadystatechange=function()
{
if(xmlHttp.readyState==4)
{
document.getElementById('output').innerHTML += xmlHttp.responseText + "<br />";
}
}
xmlHttp.open("GET","ajax-test.php?SECOND="+SECOND,true);
xmlHttp.send(null);
returntrue
}
</script></head><body>
// below is the button for passing seconds
<inputonclick="javascript:return (Delay('30')&& Delay('10')&& Delay('5'));"type="button"value="Button"name="B3"><divid='output'></div></body></html>
The PHP part (at the top) basically is just to waste some time, depending on the SECONDS value. Though, it really only takes about 1/6th the amount of time requested. Here is the output from running the script:
5: x=707.10607407910: x=999.999530: x=1732.05051889
Basically, this is just showing that 5 DELAY(5) is returning before DELAY(10) which is returning before DELAY(30), even though they are being requested in the opposite order.
So, take a look at your asp delay code, as the problem must be there. Sorry I can't help much otherwise.
Post a Comment for "How To Invoke Three Ajax Functions Together?"