jQuery(function ($) { var CreateLoginWindows = function (callback) { var h = 300; $('#CreateLoginWindowsDlg').dialog({ 500, height: h, modal: true, title: "系统登录" }); var urlStr = LoginWindowsPage; $('#CreateLoginWindowsDlg').empty(); $('#CreateLoginWindowsDlg').append("<iframe style='98%;height:98%;border:0px;' src='" + urlStr + "'></iframe>"); var top = $(document).scrollTop() + ($(window).height() - h) * 0.5; $('#CreateLoginWindowsDlg').window('open').window('resize', { top: top }); }; // 备份jquery的ajax方法 var _ajax = $.ajax; // 重写ajax方法,先判断登录在执行success函数 $.ajax = function (opt) { var _success = opt && opt.success || function (a, b) { }; var _opt = $.extend(opt, { success: function (data, textStatus) { if (data.Message == "请重新登录") {//要求登陆 CreateLoginWindows(); return false; } _success(data, textStatus); } }); _ajax(_opt); }; });