我的函数是这样的
// JavaScript Document
$('#MyFormSubmit').submit(function(){
try{
/* Ajax - 1 */
$.ajax({
url: 'Any',
type: 'GET',
data: 'ID',
contentType: "application/json;charset=utf-8",
success: function (data) {
alert("Success - 1");
},
error: function (x, y, z) {
alert("Error - 1");
}
});
/* Ajax - 2 */
$.ajax({
url: 'Any',
type: 'GET',
data: 'ID',
contentType: "application/json;charset=utf-8",
success: function (data) {
alert("Success - 2");
},
error: function (x, y, z) {
alert("Error - 2");
}
});
/* Ajax - 3 */
$.ajax({
url: 'Any',
type: 'GET',
data: 'ID',
contentType: "application/json;charset=utf-8",
success: function (data) {
alert("Success - 3");
},
error: function (x, y, z) {
alert("Error - 3");
}
});
}
catch(e){
alert(e);
}
});
如何在发生第一个错误时,停止执行下一个ajax请求?