Thursday, 29 August 2013

Continue FOR loop after a function finished

Continue FOR loop after a function finished

I have a for loop from which a function is called.In that function i have
a AJAX call.After ajax finishes then it returns a value to the for loop.
then only for loop has to be continued.
for ( var j = 0; j < req.questionId.length; j++) {
var getanswer = getAnswers();
}
function getAnswers(){
$.getJSON("getAnswers?question_id="+questionId,function(data){
return "success";
});
}

No comments:

Post a Comment