Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 582565
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T14:42:01+00:00 2026-05-13T14:42:01+00:00

This is a bit of a rant, but also a very serous question. jQuery

  • 0

This is a bit of a rant, but also a very serous question. jQuery has changed ajax param serialization as follows:

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”.

Did you catch that?

You call your parameter foo. jQuery now renames that to foo[] behind your back if foo’s value is an array. The reason for this is because some PHP-ers and Rubyists expect 3rd party APIs to rename things for them.

Call me old fashioned, but when I put something into a map, with key x, I expect to find the value under x. Or at least have this the default behavior with an optional override.

Even the documentation agrees with me:

If value is an Array, jQuery
serializes multiple values with same
key i.e. {foo:[“bar1”, “bar2”]}
becomes ‘&foo=bar1&foo=bar2’.

Am I right in thinking this is simply a bad judgment call from the jQuery team?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T14:42:01+00:00Added an answer on May 13, 2026 at 2:42 pm

    It’s actually filling in a major inconsistency, if your deserializer is aware of the convention and works with it nicely. It makes an array-of-one-thing look different from a thing-on-its-own.

    Old:

    • foo: "bar" maps to "foo=bar" maps to foo: "bar".
    • foo: ["bar"] maps to "foo=bar" maps to foo: "bar".
    • foo: ["bar", "baz"] maps to "foo=bar&foo=baz" maps to foo: ["bar", "baz"].

    New:

    • foo: "bar" maps to "foo=bar" maps to foo: "bar".
    • foo: ["bar"] maps to "foo[]=bar" maps to foo: ["bar"].
    • foo: ["bar", "baz"] maps to "foo[]=bar&foo[]=baz" maps to foo: ["bar", "baz"].

    And now everything roundtrips nicely and you don’t have to worry about receiving array data or non-array data depending on how many elements were in the array to begin with. For maximum elegance, foo: [] should also serialize to foo[] (a key with no value), indicating a 0-ary list, but jQuery 1.4 doesn’t do that. Maybe it should. 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Ok, this sounds like a bit of a rant, but I was wondering if
I have this bit of javascript written with jQuery 1.2.5. It's contained inside the
I've got this bit of JQUERY: <script> function initNav() { $('.nav tr table td
I've got this bit of jQuery with some javascript and RegEx mixed in: $(function()
I've just got this bit of code working in jQuery via an answer on
I have this bit jQuery with HTML. Unfortunately its not working correctly. Can anyone
In this bit of jQuery , I am drawing a square onto the canvas
I came across this bit of vba code posted in another SO question. Is
This bit of code does not produce any errors: //if the image has tags
I have this bit of html code, but when I click the link, it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.