I have an action which takes an view model object
[HttpPost]
public String Edit(UserGroupEditViewModel model)
{/* ... */}
Now I want to send form data async using jQuery
$('#user_dialog .edit').click(function (event) {
event.preventDefault();
var ug = $(this).parent('form').serialize();
$.ajax({
url: urlEditUserGroup,
async: true,
type: 'POST',
data: ug,
//datatype: 'json',
//contentType: 'application/json;charset=utf-8',
success: function (data) {
alert(data);
}
});
});
However, I’m not able to receive form data.
i think the form is not being serialized, try (as mentioned by @Beetroot-Beetroot)
more over you can assign an id or a class to your form so that the form can be selected easily for the serialization.
try debugging your code by putting
to check if the serialization yields results.