diff options
Diffstat (limited to 'public/javascripts/admin_search.js')
| -rw-r--r-- | public/javascripts/admin_search.js | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/public/javascripts/admin_search.js b/public/javascripts/admin_search.js index 78577e7..8ff0db1 100644 --- a/public/javascripts/admin_search.js +++ b/public/javascripts/admin_search.js | |||
| @@ -18,14 +18,19 @@ admin_search = { | |||
| 18 | } | 18 | } |
| 19 | 19 | ||
| 20 | $("#search_term").bind("keyup", function() { | 20 | $("#search_term").bind("keyup", function() { |
| 21 | if ($(this).attr("value")) { | 21 | console.log("keyup fired, value:", $(this).val()); |
| 22 | if ($(this).val()) { | ||
| 23 | console.log("sending ajax to", ADMIN_SEARCH_URL); | ||
| 22 | $.ajax({ | 24 | $.ajax({ |
| 23 | type: "GET", | 25 | type: "GET", |
| 24 | url: "/admin/search", | 26 | url: ADMIN_SEARCH_URL, |
| 25 | data: "search_term=" + $(this).attr("value"), | 27 | data: "search_term=" + $(this).val(), |
| 26 | dataType: "json", | 28 | dataType: "json", |
| 27 | success : function(results) { | 29 | success : function(results) { |
| 28 | admin_search.show_results(results); | 30 | admin_search.show_results(results); |
| 31 | }, | ||
| 32 | error: function(xhr, status, error) { | ||
| 33 | console.log("Ajax error:", status, error, xhr.status, xhr.responseText); | ||
| 29 | } | 34 | } |
| 30 | }); | 35 | }); |
| 31 | } | 36 | } |
| @@ -52,7 +57,7 @@ menu_items = { | |||
| 52 | if ($(this).attr("value")) { | 57 | if ($(this).attr("value")) { |
| 53 | $.ajax({ | 58 | $.ajax({ |
| 54 | type: "GET", | 59 | type: "GET", |
| 55 | url: "/admin/menu_search", | 60 | url: ADMIN_MENU_SEARCH_URL, |
| 56 | data: "search_term=" + $(this).attr("value"), | 61 | data: "search_term=" + $(this).attr("value"), |
| 57 | dataType: "json", | 62 | dataType: "json", |
| 58 | success : function(results) { | 63 | success : function(results) { |
| @@ -104,7 +109,7 @@ parent_search = { | |||
| 104 | if ($(this).attr("value")) { | 109 | if ($(this).attr("value")) { |
| 105 | $.ajax({ | 110 | $.ajax({ |
| 106 | type: "GET", | 111 | type: "GET", |
| 107 | url: "/admin/menu_search", | 112 | url: ADMIN_MENU_SEARCH_URL, |
| 108 | data: "search_term=" + $(this).attr("value"), | 113 | data: "search_term=" + $(this).attr("value"), |
| 109 | dataType: "json", | 114 | dataType: "json", |
| 110 | success : function(results) { | 115 | success : function(results) { |
| @@ -184,7 +189,7 @@ move_to_search = { | |||
| 184 | if (_this.attr("value")) { | 189 | if (_this.attr("value")) { |
| 185 | $.ajax({ | 190 | $.ajax({ |
| 186 | type: "GET", | 191 | type: "GET", |
| 187 | url: "/admin/menu_search", | 192 | url: ADMIN_MENU_SEARCH_URL, |
| 188 | data: "search_term=" + _this.attr("value"), | 193 | data: "search_term=" + _this.attr("value"), |
| 189 | dataType: "json", | 194 | dataType: "json", |
| 190 | success : function(results) { | 195 | success : function(results) { |
