]> git.openstreetmap.org Git - rails.git/blobdiff - app/assets/javascripts/geocoder.js
Replace some inline javascript with a UJS solution
[rails.git] / app / assets / javascripts / geocoder.js
diff --git a/app/assets/javascripts/geocoder.js b/app/assets/javascripts/geocoder.js
new file mode 100644 (file)
index 0000000..0809bef
--- /dev/null
@@ -0,0 +1,14 @@
+$(document).ready(function () {
+  $("body").on("click", ".search_more a", function (e) {
+    e.preventDefault();
+
+    var div = $(this).parents(".search_more");
+
+    div.find(".search_results_entry").hide();
+    div.find(".search_searching").show();
+
+    $.get($(this).attr("href"), function(data) {
+      div.replaceWith(data);
+    });
+  });
+});