]> git.openstreetmap.org Git - rails.git/blobdiff - app/assets/javascripts/index/search.js
Merge remote-tracking branch 'upstream/pull/4716'
[rails.git] / app / assets / javascripts / index / search.js
index b7bca1d2ac08e5dcb2f9ef31b23c0f36ef496845..1c1da3677e167167eef8c9db1ba3db9b9d2b6ef4 100644 (file)
@@ -62,13 +62,23 @@ OSM.Search = function (map) {
     e.preventDefault();
     e.stopPropagation();
 
-    var div = $(this).parents(".search_more");
+    var div = $(this).parents(".search_more"),
+        csrf_param = $("meta[name=csrf-param]").attr("content"),
+        csrf_token = $("meta[name=csrf-token]").attr("content"),
+        params = {};
 
     $(this).hide();
     div.find(".loader").show();
 
-    $.get($(this).attr("href"), function (data) {
-      div.replaceWith(data);
+    params[csrf_param] = csrf_token;
+
+    $.ajax({
+      url: $(this).attr("href"),
+      method: "POST",
+      data: params,
+      success: function (data) {
+        div.replaceWith(data);
+      }
     });
   }