Hi, I have one js file that is used by two different forms. The forms each have different ids. I've tried the following:
var formId;
...
$('#SaveButton').on('click', function () {
formId = $(this).closest("form").attr("id");
});
$(formId).submit(function (e) {
var f = $("formId");
var action = f.attr("action");
action = action.replace("Update", "Edit");
var serializeForm = f.serialize();
serializeForm = serializeForm.concat(actionStr);
$.post (action, serializeForm, function ()
{
alert("success");
});
e.preventDefault();
}
});
formId is definitely assigned the form id but the submit is not working. Any ideas how to grab the id and use it as part of the submit?
...