I have an edit details form that is displayed as a partial on a jquery ui dialog. I want to commit amendments back to the database, but I have run in to trouble using the standard submit button used on MVC3 edit forms.. I want to commit the change, but remain on the dialog.
I have put button on the page that is calling a bit of jquery (below). What I need to know is how I can serialize my model (called Models.User) and pass that back to the controller.
As you can see I have the majority of the jquery in place - all I need to do is serialize and data and send it. I am guessing I will need to use Json, but im not 100% on how to bring that in.
Any help appreciated..
<script type="text/javascript">
$(document).ready(function(e) {
$(function() {
$("#quickButton1").live("click", function (e) {
e.preventDefault();
$.ajax({
url: "/Users/QuickEditSave/",
data: ({}),
success: function (data) {
uiDialog.close();
},
error: function(xhr, ajaxOptions, thrownError) {
alert(xhr.responseText);
}
});
});
});
});
</script>