This article turns from: 71514822
First, when the order of execution is ensured:
1, request add async:false, so that all Ajax will be executed synchronously, the order of requests is the code sequence
2, $.when ($.ajax (
{Async:false,
Url:url1
}
), $.ajax (
{Async:false,
Url:url2
}
). Done (function () {
Alert ("Done");
}). Fail (function () {
Alert ("fail");
});
Second, ensure that all asynchronous AJAX requests are complete
1, ajax6 = $.ajax (
{
URL: "/home2/selectyjloginuser",
DataType: "JSON",
Type: "Post",
Success:function (pararesponse) {
}
});
AJAX7 = $.ajax (
{
URL: "/home2/selectyjzh",
DataType: "JSON",
Type: "Post",
Success:function (pararesponse) {
}
});
Make sure (ajax6, ajax7 two requests are complete
$.when (ajax6, ajax7). Done (function () {
The action
});
}
2, the second kind of the above can also be used
Control the order of execution or the execution of all after [go] multiple AJAX requests