From 0cab80cf919096af508ed1be3778caec86f073fa Mon Sep 17 00:00:00 2001 From: Promofaux Date: Fri, 10 Jun 2016 22:16:10 +0100 Subject: [PATCH] parse output of add.php, decide whether to show error or success. --- js/pihole/list.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/js/pihole/list.js b/js/pihole/list.js index ada38223..652607b5 100644 --- a/js/pihole/list.js +++ b/js/pihole/list.js @@ -85,8 +85,15 @@ function add() { method: "post", data: {"domain":domain.val(), "list":list_type, "token":token}, success: function(response) { - if(response.length !== 0) - return; + if (response.indexOf("not a valid argument")>=0) { + alFailure.show(); + alFailure.delay(1000).fadeOut(2000, function() { + alFailure.hide(); + }); + alInfo.delay(1000).fadeOut(2000, function() { + alInfo.hide(); + }); + } else { alSuccess.show(); alSuccess.delay(1000).fadeOut(2000, function() { alSuccess.hide(); @@ -96,6 +103,7 @@ function add() { }); domain.val(""); refresh(true); + } }, error: function(jqXHR, exception) { alFailure.show();