]> git.openstreetmap.org Git - rails.git/blobdiff - app/assets/javascripts/index/new_note.js
Merge remote-tracking branch 'upstream/pull/3767'
[rails.git] / app / assets / javascripts / index / new_note.js
index 73fcda97c5e9421c99daf2ae4d7b92b794f0b3f9..b1457d10b0233a745b5e9c4a2736637bcfe63834 100644 (file)
@@ -34,17 +34,17 @@ OSM.NewNote = function (map) {
   });
 
   function createNote(location, text, callback) {
-    $.ajax({
-      url: "/api/0.6/notes.json",
-      type: "POST",
-      oauth: true,
-      data: {
+    fetch("/api/0.6/notes.json", {
+      method: "POST",
+      headers: { ...OSM.oauth },
+      body: new URLSearchParams({
         lat: location.lat,
         lon: location.lng,
         text
-      },
-      success: callback
-    });
+      })
+    })
+      .then(response => response.json())
+      .then(callback);
   }
 
   function addCreatedNoteMarker(feature) {