jQuery Ajax 拦截
jQuery ajax 异步请求拦截
1 (function($) { 2 var ajax = $.ajax; 3 $.ajax = function(s) { 4 var old = s.success; 5 s.success = function(resultData, textStatus, jqXHR) 6 { 7 if(resultData.isException){ 8 alert('程序异常,请重新登录!'); 9 window.location = base_url + '/login'; 10 } 11 if(resultData.isSessionOut){ 12 alert('登录超时,请重新登录!'); 13 window.location = base_url + '/login'; 14 return false; 15 }else if( resultData.accessModuleNoRight ) 16 { 17 alert(resultData.message); 18 return false; 19 } 20 old(resultData, textStatus, jqXHR); 21 } 22 ajax(s); 23 } 24 })(jQuery);

浙公网安备 33010602011771号