我试图使用while循环返回$ .ajax查询的响应,该循环进入无限循环 继承人的代码
//The function that makes the jax call and stores the response
function findResponse(Reqtype,Requrl) {
var response;
while(!response) {
function keepFinding() {
$.ajax({
type: Reqtype,
url: Requrl,
success:function(data) {
response=data;
}
})
}
}
return response;}
这是对函数的调用
var emailResponse = findResponse("get","form.php?emailField="+x);
console.log(emailResponse);