标签:ajax
(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,status,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, textStatus, xhr);
}
};
ajax(s);
}
})(jQuery);
标签:ajax
原文地址:http://blog.csdn.net/liubowin/article/details/42170315