Jquery Ajax Call运行无限循环

时间:2015-03-09 15:39:47

标签: javascript jquery ajax

我试图使用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);

0 个答案:

没有答案