我有下一个代码,我知道这不太好,
var addrIds = [1000,1001,1003,1004,1005];
$.each(addrIds, function (index, adr) {
var data = { "addressId": parnetId, "parentId": adr };
$.ajax({
url: '/Change',
type: 'POST',
contentType: 'application/json',
dataType: "json",
cache: false,
data: JSON.stringify(data),
success: function (result) {
},
complete: function (e, xhr, settings) {
switch (e.status) {
case 200:
break;
default:
{
console.log(e.statusText);
}
}
}
});
});
是否可以重新考虑这一点并创建 ajax 请求链