我有一个执行某些任务的函数。在函数内部我有一个 ajax 调用。如果从 ajaxcall 获得的响应为真,则该函数应该继续执行任务的其余部分。否则它应该在该点本身停止。但是上面所说的事情并没有发生,而是该函数独立于 ajax 调用执行。请帮帮我
function f1(id)
{
var test= id
var url="contentserver?pagename=mandatory@id"=+id;
var ajax=new Ajaxrequest(url,validatecallback);
ajax.doGet();
if(id==true){
return;
}
........(some code which has to carried out after the ajax call)
}
function validatecallback
{
this function gets the response for the above mentioned ajaxcall
we are setting a global variable(i.e id) here so that we can use that we can retrieve that in function f1
}