summaryrefslogtreecommitdiff
path: root/public/javascripts/admin_search.js
diff options
context:
space:
mode:
Diffstat (limited to 'public/javascripts/admin_search.js')
-rw-r--r--public/javascripts/admin_search.js49
1 files changed, 24 insertions, 25 deletions
diff --git a/public/javascripts/admin_search.js b/public/javascripts/admin_search.js
index ba52bb5..e339c49 100644
--- a/public/javascripts/admin_search.js
+++ b/public/javascripts/admin_search.js
@@ -11,30 +11,29 @@ admin_search = {
11 } 11 }
12 12
13 $("#search_term").bind("keyup", function() { 13 $("#search_term").bind("keyup", function() {
14 if ($(this).attr("value")) { 14 if ($(this).attr("value")) {
15 $.ajax({ 15 $.ajax({
16 type: "GET", 16 type: "GET",
17 url: "/admin/search", 17 url: "/admin/search",
18 data: "search_term=" + $(this).attr("value"), 18 data: "search_term=" + $(this).attr("value"),
19 dataType: "json", 19 dataType: "json",
20 success : function(results) { 20 success : function(results) {
21 admin_search.show_results(results); 21 admin_search.show_results(results);
22 } 22 }
23 }); 23 });
24 } 24 }
25 else { 25 else {
26 $('#search_results').slideUp(); 26 $('#search_results').slideUp();
27 $('#search_results').empty(); 27 $('#search_results').empty();
28 } 28 }
29 }); 29 });
30 }, 30 },
31 31
32 show_results : function(results) { 32 show_results : function(results) {
33 $('#search_results').empty(); 33 $('#search_results').empty();
34 for (result in results) { 34 for (result in results) {
35 $('#search_results').append("<p><a href='"+ results[result].edit_path + "'>" + results[result].title + "</a></p>"); 35 $('#search_results').append("<p><a href='"+ results[result].edit_path + "'>" + results[result].title + "</a></p>");
36 }
37 $('#search_results').slideDown();
38 } 36 }
39 37 $('#search_results').slideDown();
40 } \ No newline at end of file 38 }
39} \ No newline at end of file