I know this issue has been touched on before, e.g. here:
How to post an array of complex objects with JSON, jQuery to ASP.NET MVC Controller?
But the soluti
You can serialize the form as Vikas posted, or you could use a stringify
function if you'd prefer to walk the page (as you are currently doing) and use the postData
array.
On the controller, you'll need to handle the json string. You can use the System.Web.Script.Serialization.JavaScriptSerializer
class to deserialize it. If you have an object that maps to the data you're passing, you can use the Deserialize method. If you don't, you can still use DeserializeObject, however that gives you a Dictionary<string, string>
collection that you'll have to walk through to get your data. Not exactly fun (trust me), but it works.