I call ajax request in a loop. Around 20 of them. But few are getting aborted. How can I avoid that ?
Most of them are getting aborted.
function callURLAsync(url)
{
var xmlHttpReq = false;
var self = this;
// Mozilla/Safari
if (window.XMLHttpRequest)
{
self.xmlHttpReq = new XMLHttpRequest();
}
// IE
else if (window.ActiveXObject)
{
self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
}
self.xmlHttpReq.open('POST', url, true);
self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
self.xmlHttpReq.onreadystatechange = function()
{
if (self.xmlHttpReq.readyState == 4) {
}
}
self.xmlHttpReq.send();
}
function startLogout(){
for(var i=0;i< 20;i++){
callURLAsync("myDummyURl");
}
}
Thanks Sailesh