diff --git a/scripts/pi-hole/js/list.js b/scripts/pi-hole/js/list.js index 664d64b2..e438f1b9 100644 --- a/scripts/pi-hole/js/list.js +++ b/scripts/pi-hole/js/list.js @@ -141,7 +141,7 @@ function add(arg) { $.ajax({ url: "scripts/pi-hole/php/add.php", method: "post", - data: {"domain":domain.val(), "list":locallistType, "token":token}, + data: {"domain":domain.val().trim(), "list":locallistType, "token":token}, success: function(response) { if (response.indexOf("] Pi-hole blocking is ") === -1) { alFailure.show(); diff --git a/scripts/pi-hole/js/queryads.js b/scripts/pi-hole/js/queryads.js index 5d56068f..b86a0309 100644 --- a/scripts/pi-hole/js/queryads.js +++ b/scripts/pi-hole/js/queryads.js @@ -57,9 +57,10 @@ function httpGet(ta,quiet,theUrl) function eventsource() { var ta = $("#output"); - var domain = $("#domain"); + var domain = $("#domain").val().trim(); var q = $("#quiet"); - if(domain.val().length === 0) + + if(domain.length === 0) { return; } @@ -73,12 +74,12 @@ function eventsource() { // IE does not support EventSource - load whole content at once if (typeof EventSource !== "function") { - httpGet(ta,quiet,"/admin/scripts/pi-hole/php/queryads.php?domain="+domain.val().toLowerCase()+exact+"&IE"); + httpGet(ta,quiet,"/admin/scripts/pi-hole/php/queryads.php?domain="+domain.toLowerCase()+exact+"&IE"); return; } var host = window.location.host; - var source = new EventSource("/admin/scripts/pi-hole/php/queryads.php?domain="+domain.val().toLowerCase()+"&"+exact); + var source = new EventSource("/admin/scripts/pi-hole/php/queryads.php?domain="+domain.toLowerCase()+"&"+exact); // Reset and show field ta.empty();