在我的页面中,我使用 8 ajax 调用将数据发送到服务器端......
我不想为每个 ajax 调用处理 ajax 错误......
单个 ajax 错误处理整个页面中的所有 ajax 错误....
他们的任何继承是否可以用于整个页面..
function SendConfirmationEmail(ShipmentID, ChannelOrderReference) {
var Url = '<%=Url.Action("SendShipmentEmail","Shipments") %>';
$.ajax({
cache: false,
type: "POST",
data: 'strOrderShipmentId=' + ShipmentID + '&channelOrderReference=' + ChannelOrderReference,
url: Url,
datatype: "HTML",
success: function (data) {
if (data == "1") {
SucessErrorMessageDisplay('DivStatus', 'lblStatus', 'imgStatus', 0, 'Email is successfully sent for Order#' + ChannelOrderReference + '');
}
if (data == "-2") {
SucessErrorMessageDisplay('DivStatus', 'lblStatus', 'imgStatus', 0, 'Email Template is not Choosen for this Store');
}
if (data == "-1") {
SucessErrorMessageDisplay('DivStatus', 'lblStatus', 'imgStatus', 0, 'Problem in Sending Email for Order#' + ChannelOrderReference + '');
}
if (data == "0") {
SucessErrorMessageDisplay('DivStatus', 'lblStatus', 'imgStatus', 0, 'Connection Failed to Send Email for Order# ' + ChannelOrderReference + '');
}
if (data == "-3") {
SucessErrorMessageDisplay('DivStatus', 'lblStatus', 'imgStatus', 0, 'ShipTo Email Address is Not Given for Order# ' + ChannelOrderReference + '');
}
// SucessErrorMessageDisplay('DivStatus', 'lblStatus', 'imgStatus', 0, 'Order# :' + ChannelOrderReference + ' is voided successfully');
},
error: function (xhr, ajaxOptions, thrownError) {
if (xhr.status == 403) {
window.location.href = '<%: Url.Action( "SessionExpire", "Home" ) %>';
}
}
});
}