(function($) {
var ajax = $.ajax;
$.ajax = function(s) {
var old=s.error;
var old1 = s.success;
s.error = function(xhr,status,err) {
//可加上自己的判断处理
var flag = xhr.getResponseHeader("noPermissions");
if(flag != null && flag != ""){
var result = xhr.responseText;
var data = eval("(" + result + ")");
alert(data.msg);
window.location.href = data.url;
}else{
old(xhr,err);
}
};
s.success = function(data,textStatus,xhr){
//可加上自己的判断处理var flag = xhr.getResponseHeader("noPermissions"); if(flag != null && flag != ""){ var result = xhr.responseText; var data = eval("(" + result + ")"); alert(data.msg); window.location.href = data.url; }else{ old1(data,xhr); } }; ajax(s); } })(jQuery);
原文链接:https://www.f2er.com/ajax/163944.html