Quote:
Given you want to submit the original form, when user clicks on the submit button on the modal dialog
you whould need to wire up the
click
event on that button and programmatically submit your form
try something like below:
1. Give your submit button inside the modal an
Id
to wire up the click event.
<input type="submit" id="btn-submit" class="btn btn-primary" />
2. Register click event on this button.
3. Use the jQuery
closest
method to get the form where you forms submit button is present
4. Use the form submit button using the jquery to save.
$(function () {
$("#btnSubmit").click(function (e) {
e.preventDefault();
$('#AllyourChanges').modal("show");
});
$("#btn-submit").click(function() {
alert("Submit base form!");
$("#btnSubmit").closest("form").submit();
});
});
UPDATE, if needed, a similar query probably:
javascript - Insert Data from Modal Bootstrap MVC 4 + JQuery (Post Method) - Stack Overflow[
^]