//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()
- 呼び出されてから 15 秒後setTimeout()
。
showLoginAgain()
最初のajax呼び出しが呼び出されるまでに、2番目のajax呼び出しで変数の値を変更する方法は?