当登录的Session失效后,采用ajax请求数据时会没有反应,这时候应该自动跳转到登录页面,让用户重新登录。
全局配置以下可实现
$(function() { $.ajaxSetup({ complete:function(XMLHttpRequest,textStatus){ if(textStatus=="parsererror"){ window.location.href = '../login.html'; } else if(textStatus=="error"){ } } }); }