Admin User     Feb,08 2017

Facing nested param serialization problem - Appending "[]" after variable - jQuery.

Our current application has been affected by a change in the latest jQuery (1.4.1) from the previous release.

In form submission using ajax, jQuery now posts multiple selectbox or checkboxes values with a character "[]" appended to variable (I think jQuery is being more favorable to PHP).

I used firebug to look my argument passed. Just look below how it passed an argument with "[]" appended.

It is just because jQuery 1.4 adds support for nested param serialization in jQuery.param, using the approach popularized by PHP, and supported by Ruby on Rails.

For instance, {foo: ["bar", "baz"]} will be serialized as "foo[]=bar&foo[]=baz".

If its added for PHP or Ruby on Rails support then what about others existing application? I think jQuery should give an optional boolean param (language specific) for them to set up these settings.

If you need the old behavior, you can turn it back on by setting the traditional Ajax setting.

jQuery.ajaxSettings.traditional = true;