Javascript ajax asynchronous question...
- by Polaris878
Hello,
I'm wondering if anyone can help me understand some asynchronous javascript concepts...
Say I make an asynch ajax call like so:
xmlhttp=new XMLHttpRequest();
xmlhttp.onreadystatechange= myFoo;
xmlhttp.open("GET",url,true);
Here is my callback function:
function myFoo()
{
if (xmlhttp.readyState==4)
{
if (xmlhttp.status==200)
{
// Success message
}
else
{
// some error message
}
}
}
Now,
where and when does the execution path start again? Once I make the call to open(), does execution continue directly below the open() and another "thread" enters the asynch function once the ajax request has been completed?
Or, does the browser wait for the request to complete, make the Asynch call, and then execution continues right after the open?
Thanks!