//to make an ajax call to server to get to get the list data
function makeAjaxCall()
{
loginSuccess =0;
//to make an ajax call to server to get the supported banks details
var xmlhttp;
// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
xmlhttp.onreadystatechange=function()
{
alert('here'+xmlhttp.readyState+'stat='+xmlhttp.status)
if( xmlhttp.readyState==4 && xmlhttp.status==200 )
{
alert(xmlhttp.responseText)
if(xmlhttp.responseText != '' )
{
loginSuccess =1;
renderResponse(xmlhttp.responseText);
}
//else
{
}
}
//else if( )
}
var params = "flagLogin="+flagLogin+"&listName="+selectedList+formData+loginPara;
//var url = serverURL;
var url = 'https://blah.com';
//alert('param='+params)
xmlhttp.open("POST",url,true);
xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
xmlhttp.send(params);
setTimeout('showLoginAgain()',15000);
// return
return;
}
在上面的代码中,我正在进行ajax调用,并且我希望在loginSuccess
被调用时使用全局变量showLoginAgain()
的值 - 在setTimeout()
被调用后15秒。
如何调用第二个ajax调用,在调用第一个ajax调用的时候showLoginAgain()
更改变量的值?