Skip to main content

Bug Tracker

Side navigation

#6057 closed bug (wontfix)

Opened February 09, 2010 06:30AM UTC

Closed October 20, 2010 03:40AM UTC

JQuery.getJSON malformed url

Reported by: FernandoEscher Owned by:
Priority: undecided Milestone: 1.4.2
Component: ajax Version: 1.4.1
Keywords: jquery 1.4.1 json ajax getjson Cc: fernandoiriase@hotmail.com
Blocked by: Blocking:
Description

When you try to pass an array of elements as the getJSON's data, the url is malformed and the get request fails with a 404 error.

In JQuery 1.3.2 you were able to do things like:

a= ['n1','n2','n3'];

$.getJSON('/some/url/here/', {'e': a}, function(json){...});

And the wellformed url is:

/some/url/here/?e=n1&e=n2&e=n3

Which worked very well with me, but now, in JQuery 1.4.1, the url is malformed this way:

/some/url/here/?e[]=n1&e[]=n2&e[]=n3

Which result in the error expleined above.

This might need some revision to resolve this issue.

Attachments (0)
Change History (3)

Changed February 10, 2010 05:34AM UTC by john comment:1

resolution: → wontfix
status: newclosed

You'll need to set the traditional flag to true, as documented in the API docs:

http://api.jquery.com/jQuery.param/

Changed March 31, 2010 04:35PM UTC by ubernostrum comment:2

resolution: wontfix
status: closedreopened

This causes jQuery to be broken by default for anyone not using something which adopts the Rails/PHP-style convention (as evidenced by the fact that we just spent some time tracking down why this was breaking jQuery interactions with a Django application), and so is a bug.

The right thing to do is encode normally by default, and let people whose tools require weird contortions turn those contortions on as needed. Or, if your position is that jQuery should only work by default for people using Rails or PHP, the documentation for that ought to be clear and up-front.

Changed October 20, 2010 03:40AM UTC by addyosmani comment:3

priority: → undecided
resolution: → wontfix
status: reopenedclosed

Given that we've already stated the behavior here is something which has been documented and we're explicitly asking developers to follow those guidelines, I think that John's original resolution should still stand. Closing for now.