Question about javascript xmlhttp and there response
as a fix to a previous problem of mine, i have thought to run a cURL script using JavaScript to prevent my site waiting for a response of each one.
at the moment I have this script given by a friend and i have noticed something.
开发者_如何转开发Link to JS file
My question is if I were to remove the following lines, would it mean that the page would not wait for a response?
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
setTimeout("location.reload(true)",1500);
}
}
Thanks.
If you remove the lines, it will not go anywhere.
If you want to speed it up, get rid of the setTimeout line, that is not nessecary.
If you were to remove the if statement, and just do the window.locaiton line, it will fire before the request is made since that onreadystatechange fires to tell you when the request is opened, started, transferring, and done.
Ajax 101 Article
精彩评论