jquery - Is it possible to bind a list of complex json objects to a C# object using an ajax GET request? -
public class person { public int id { get; set; } public string name { get; set; } } public actionresult test (list<person> persons) { ... }
javascript:
var person = { name: "p1", id: 1 }; var persons = []; persons.push(person); persons.push(person); var json = json.stringify(persons); $.ajax({ url: '@url.action("test")', type: 'get', datatype: 'json', data: json, contenttype: 'application/json; charset=utf-8', });
i trying send list of person objects controller using request. problem persons list null. when make post request works fine.
is possible bind list of complex json objects c# object using ajax request?
is possible bind list of complex json objects c# object using ajax request?
no, isn't. remember there's limit in query string send, having complex objects in request not should doing anyway. verb used retrieving data simple things id , couple of other query string parameters, not sending complex objects.
Comments
Post a Comment