diff --git a/youmap/templates/chickpea/map_update_tilelayers.html b/youmap/templates/chickpea/map_update_tilelayers.html
index e214ec6fc6df0f58d04c3c228afcd334ce255f54..592b78f395113d8339420cf6ec7f16e9ce89feb0 100644
--- a/youmap/templates/chickpea/map_update_tilelayers.html
+++ b/youmap/templates/chickpea/map_update_tilelayers.html
@@ -19,23 +19,5 @@
 </form>
 
 <script type="text/javascript">
-    $("#map_edit").on("submit", function (e) {
-        e.preventDefault();
-        L.Util.Xhr.submit_form("map_edit", {
-            'callback': function (data) {
-                if (data.redirect) {
-                    window.location = data.redirect;
-                }
-                else if (data.info) {
-                    $div = $('<div>').addClass('alert-box success').html(data.info);
-                    $div.append('<a href="#" class="close">&times;</a>');
-                    $("#map").prepend($div);
-                }
-                else {
-                    $("#map_edit").parent().empty().append(data.html);
-                }
-            },
-            'dataType': 'json'
-        });
-    });
+    L.Util.Xhr.listen_form('map_edit');
 </script>
\ No newline at end of file