Why can't I post an object containing both a model and a integer(id) from mvc view to action using jQuery? I am trying to post an object containing a model and a (int)ID from my view to MVC action.The problem is, I can post id(int) but cannot pass Model, while the controller receives the ID correctly but Model is empty. I tried many things but it doesn't work and Model is always empty.But when I just pass model on its own then it works(not empty). Can someone suggest me some idea?
jQuery Code:
$.ajax({
type: 'post',
url: '@Url.Action("AddProfileAddress", "Account")',
data: {
model1: $('#frmAddProfileAddress').serialize(),
id: 3
}
});
Controller
<HttpPost()> _
Public Function AddProfileAddress(ByVal model1 As Address, id As Integer) As ActionResult
{
...
}
What am I doing wrong?