/** * 获取项目跟路径 * @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: "好的", }); } } } });