I am trying to return the Response of a $.ajax query using the while loop which runs into an infinite loop Heres the code
//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;}
And here is the Call to the function
var emailResponse = findResponse("get","form.php?emailField="+x);
console.log(emailResponse);