Skip to content

use 'traditional' params in jQuery

Latest
Compare
Choose a tag to compare
@RobertoMaurizzi RobertoMaurizzi released this 31 Jul 01:49
f1d5ec0

For the last (not so) few jQuery versions, a query containing array values (e.g. district=['district1', 'district2']) would get rendered as "?district[]=district1&district[]=district2" when converting data to url format.
In addition, the form parsing won't create an array when only one value is selected, causing parameter name change when the user selects more than one (from district=onlydistrict to district[]=firstdistrict&district[]=seconddistrict).

Setting the 'traditional' parameter to True in $.ajax and $.param makes them behave as before (and works around the bug in form parsing)