I post $(\'#myForm\').serializeArray()
to an ASP.NET MVC (2.0) action.
serialized array looks as follows:
filters[0][name] : gemcolor
filters[0][
I know this is old, but how about something like this - this is what I use generically on my pages to submit via ajax:
$(function () {
@*-- PostAll--*@
$(".postAll").click(function () {
var container = $(this).closest(".postGroup");
var p = {};
container.find("input[type='text'], input[type='radio']:checked, input:checkbox:checked, textarea").each(function (i, e) {
p[$(e).attr("name")] = $(e).val();
});
container.find('select').each(function (i, e) {
p[$(e).attr("name")] = $(e).find('option:checked').val();
});
$.post($(this).data("url"), p, function (data, status) {
//Do Some Notification
})
});
});
I tend to have html structure as:
Something like this:
Then you can have a normal model to capture what you need. Not sure if this is the best way or anything but I use this a of times.