Hi guys,
Please refer the code below,
I already set both of the ajax as async : false.
I found out that when the function calling doUpdate2ndAJAX(), the program start executing $(".search").click(); even though doUpdate2ndAJAX() not yet finish executing.
In short current situation:
1. doUpdate2ndAJAX() execute
2. doUpdate2ndAJAX() not yet finish, start execute $(".search").click()
3. doUpdate2ndAJAX() Finish execute and response back
May I know how can I make it as
1. doUpdate2ndAJAX() execute
2. doUpdate2ndAJAX() Finish execute and response back
3. call $(".search").click();
[ Execute in sequence order ]
Thanks.
-fsloke
Code:
firstCalled: function() {
$.ajax({
url: "XXX",
async: false,
success: function(response) {
doUpdate2ndAJAX();
$(".search").click();
}
});
}
function doUpdate2ndAJAX(){
$.ajax({
url: "YYY",
async: false,
success: function(response) {
// UPDATE SOMETHING
}
});
return false;
}
|