$(function () {
// Don't allow browser caching of forms
$.ajaxSetup({ cache: false });
var dialog = $('#form-modal').dialog({
autoOpen: false,
resizable: true,
height: 600,
width: 800,
modal: true,
title: 'Update profile',
buttons: {
"Submit": function () {
// Manually submit the form
var form = $('form', this);
$(form).submit();
return true;
},
Cancel: function () {
$(this).dialog("close");
return false;
}
}
});
if ($("#showFormBtn").length > 0) {
$("#showFormBtn").button().on("click", function () {
dialog.dialog("open");
});
}
});
What I want to do is to send the form by ajax to the action and display the content returned from action in the same modal popup (replace the form with the result data).
1.
The problem I have now is that I get a js error on form.submit() line
Uncaught ReferenceError: Sys is not defined
2.
Also how to update the modal content with the confirmation data after submitting?
Submit form from modal dialog and display confirmation
I'm doing a dialog modal on my umbraco page.
In the view I have:
The partial view:
The Dialog.js script:
What I want to do is to send the form by ajax to the action and display the content returned from action in the same modal popup (replace the form with the result data).
1. The problem I have now is that I get a js error on form.submit() line
2. Also how to update the modal content with the confirmation data after submitting?
Will be grateful for help. Thank you.
I think you need to look at the way your JavaScript is loaded.
Here is a StackOverflow post that may help:
http://stackoverflow.com/questions/15442548/sys-is-undefined-ajax-master-and-contentpages-asp-net-4-0
Thanks Mark but the post you pasted elates to WebForms while I'm using MVC as per my post.
I have found the answer here: http://stackoverflow.com/questions/1035663/asp-net-mvc-ajax-sys-is-undefined-error
I added
to my web.config file and it worked.
Cool!
is working on a reply...