J
jodleren
I use ajax to load data, which can be slow. Normally it takes 2-14
seconds, but the record is 84 seconds. I have found, that after 40
seconds, most browsers consider the connection lost, e.g. the 84
example - got data, but the connection was cancelled, so I never got
to know.
In my code, I can take it apart, and run it several times, or more in
parallel.... - n PHP.
Still, I need a bright way, so
1) return a code and load again in AJAX
2) open multiple pages at once
3) _________ ?
Any ideas?
WBR
Sonnich
My code as of now:
var xmlHttp = window.XMLHttpRequest ? new XMLHttpRequest() : new
ActiveXObject("MSXML2.XMLHTTP.3.0");
xmlHttp.onreadystatechange = function()
{
ShowETime(); // starts timer and shows the loading time
if(xmlHttp.readyState==1)
statusID.innerHTML="Please wait, loading...";
else if(xmlHttp.readyState==4)
{
if(xmlHttp.status==200)
{
// if(xmlHttp.responseText=="Done.")
// something to load again, if there is more
{
statusID.innerHTML=xmlHttp.responseText;
StartUp2(); // something else...
}
}
else
statusID.innerHTML="<span class=\"message_fail\">Connection
error</span>";
clearInterval(timer1);
}
}
xmlHttp.open("get","mypage.php?loadid=<?php echo rand(); ?>");
xmlHttp.send(null);
seconds, but the record is 84 seconds. I have found, that after 40
seconds, most browsers consider the connection lost, e.g. the 84
example - got data, but the connection was cancelled, so I never got
to know.
In my code, I can take it apart, and run it several times, or more in
parallel.... - n PHP.
Still, I need a bright way, so
1) return a code and load again in AJAX
2) open multiple pages at once
3) _________ ?
Any ideas?
WBR
Sonnich
My code as of now:
var xmlHttp = window.XMLHttpRequest ? new XMLHttpRequest() : new
ActiveXObject("MSXML2.XMLHTTP.3.0");
xmlHttp.onreadystatechange = function()
{
ShowETime(); // starts timer and shows the loading time
if(xmlHttp.readyState==1)
statusID.innerHTML="Please wait, loading...";
else if(xmlHttp.readyState==4)
{
if(xmlHttp.status==200)
{
// if(xmlHttp.responseText=="Done.")
// something to load again, if there is more
{
statusID.innerHTML=xmlHttp.responseText;
StartUp2(); // something else...
}
}
else
statusID.innerHTML="<span class=\"message_fail\">Connection
error</span>";
clearInterval(timer1);
}
}
xmlHttp.open("get","mypage.php?loadid=<?php echo rand(); ?>");
xmlHttp.send(null);