0
    //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()

如何使第二个ajax调用在调用showLoginAgain()第一个ajax调用时更改变量的值?

4

0 回答 0