我同时调用了2个ajax函数用于发送,这2个都等待返回结果,当第二个返回时覆盖了第一个返回结果的值,请问如何解决这个问题,谢谢各位大虾了
if (xmlhttp != null)
{
xmlhttp.onreadystatechange = function postRequestStrAnswer()
{
if(xmlhttp.readyState == 4 && xmlhttp.status == 200)
{
try
{
var objText = getReturnStr(xmlhttp.responseText);
if (state==true && objText!=null) { RestoreHtml(objText);}
if (asyncfun!=null && objText!=null ) { asyncfun(objText); }
}
catch(e) { alert(e); }
}
}
xmlhttp.open("POST",url,true);
xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xmlhttp.setRequestHeader("Accept-Encoding", "gzip, deflate");
if (obj!=null) { postContent = postConversionStr(obj);}
if (state==true) { postContent += "&" + postFormStr(); }
xmlhttp.send(postContent);
}
绝地无双