How to pass to eventData for .submit ()?

There is no usage example in the documentation.submit( [eventData], handler(eventObject) )

I have the following function where I need to pass the url to row_save ().

function row_edit() {
    var url = $(this).attr("href");
    var row = $(this).closest('tr')
    row.load(
        url + "/",
        null,
        function () {
            $("#save-form").submit(url, row_save); // ?? Not sure
        }
    );
    return false;
}


function row_save() {
  var url = ????
  var item = $(this).parent();
  var data = {
    item_description: item.find("#id_item_description").val()    
  };
  $.post(url, data, function (result) {
    if (result != "failure") {
      item.before($("li", result).get(0));
      item.remove();
      $(".row_edit").click(row_edit);
    }
    else {
      alert("Failed to validate before saving.");
    }
  });
  return false;
}

thank

+5
source share
1 answer

eventData strong> The data map to be passed to the event handler

function () {
    $("#save-form").submit({ "url": url }, row_save);
}

function row_save(ev) {
    var url = ev.data.url;
    // ...
}
+5
source

All Articles