From 6eb7f963bcb00b7beadba8e655d359aeefd2d933 Mon Sep 17 00:00:00 2001 From: zhaoxiang <756958008@qq.com> Date: Mon, 21 Nov 2016 18:24:35 +0800 Subject: [PATCH] =?UTF-8?q?modified=20Ajax=E7=9B=B8=E5=BA=94404=E5=92=8C50?= =?UTF-8?q?0=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/admin/static/js/template.js | 40 +++++++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 3 deletions(-) diff --git a/public/admin/static/js/template.js b/public/admin/static/js/template.js index 4673d49..73d4955 100644 --- a/public/admin/static/js/template.js +++ b/public/admin/static/js/template.js @@ -100,6 +100,16 @@ } }, 1000*data.wait); } + }, + statusCode: { + 404: function() { + loadingBox.modal('hide'); + $.alertMsg('页面未找到'); + }, + 500: function () { + loadingBox.modal('hide'); + $.alertMsg('服务器内部错误,请联系管理员!'); + } } }); }; @@ -157,7 +167,15 @@ $.ajax({ type: "PUT", url: target, - data: query + data: query, + statusCode: { + 404: function() { + $.alertMsg('页面未找到'); + }, + 500: function () { + $.alertMsg('服务器内部错误,请联系管理员!'); + } + } }).done(function( data ) { var wait = 1000*data.wait; if (data.code == 1) { @@ -204,7 +222,15 @@ $.ajax({ type: "DELETE", url: url, - data: urlData + data: urlData, + statusCode: { + 404: function () { + $.alertMsg('页面未找到'); + }, + 500: function () { + $.alertMsg('服务器内部错误,请联系管理员!'); + } + } }).done(function( data ) { var wait = 1000*data.wait; if (data.code == 1) { @@ -250,7 +276,15 @@ $.ajax({ type: "PUT", url: url, - data: urlData + data: urlData, + statusCode: { + 404: function () { + $.alertMsg('页面未找到'); + }, + 500: function () { + $.alertMsg('服务器内部错误,请联系管理员!'); + } + } }).done(function( data ) { var wait = 1000*data.wait; if (data.code == 1) {