/** * 获取项目跟路径 * @returns */ function getrootpath() { return $("#rootpath").val(); } if (window.top !== window.self) { top.location.href = location.href; } //ajax请求发送之前运行的函数 $(document).ajaxsend(function(event, xhr, options){ $.myloadding(); }); //ajax请求完成时运行的函数 $(document).ajaxcomplete(function(event, xhr, options){ $.removemoda(); }); //ajax全局错处理 $(document).ajaxerror( function(event, xhr, options, exc){ //console.log("xhr:"+json.stringify(xhr)); if(xhr && xhr.status && xhr.responsetext){ var json = json.parse(xhr.responsetext); if (json.returncode == 500) { // 参数校验异常 if (json.resultcode == 'param_error') { swal({ title : "温馨提示", text : json.data[0].message, confirmbuttontext: "好的", }); } //其他未知异常 else { swal({ title : "温馨提示", text : json.message, confirmbuttontext: "好的", }); } } } });