I have the following code:
JQuery
$.ajax({ url: '/personcontroller/getperson', cache: false, type: "POST", data: $('#person').serialize(), success: function(data) { alert('yay'); } }); });
Controller:
public ActionResult getPerson(Person person) { return new Json(person); }
Html Form / Spark:
<form id="person"> <input id="person.Id" type="hidden" value="${ViewData.Model.Person.Id}" /> <input id="person.Name" value="${ViewData.Model.Person.Name}"></input> <input id="person.Age" value="${ViewData.Model.Person.Age}"></input> <input value="${ViewData.Model.Person.Gender}"></input> </form>
When I submit an ajax call with the form and set a breakpoint in my action. The person object is not populated with input values, I feel like I'm missing something very simple ... Can you point me to this: |
source share