---------Javascript --------------------
var timeoutId = window.setTimeout(
function() {
if ( callInProgress(xmlHttp) ) {
xmlHttp.abort();
xmlHttp.responseText = 'timeout';
eval(varPostFunction);
} //end if
} //end function
,1000 // 3 seconds
); //end setTimeout
function GenericAjax(varURL, varPostFunction) {
var rand = Math.random() * 1000;
varURL = varURL + "&random=" + rand;
var xmlHttp;
try
{
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
try
{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
try
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e)
{
alert("Your browser does not support AJAX!");
return false;
}
}
}
xmlHttp.onreadystatechange=function()
{
if(xmlHttp.readyState==4)
{
window.clearTimeout(timeoutId);
eval(varPostFunction);
}
}
xmlHttp.open("GET",varURL,true);
xmlHttp.send(null);
}
---------Addition to ASPX page to make over 5 seconds to timeout
Dim dtTime As Date
dtTime = Now()
Do While DateAdd(DateInterval.Second, 6, dtTime) > Now()
Loop
|