Bug Tracker

Opened 10 years ago

Closed 9 years ago

#6057 closed bug (wontfix)

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@…
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.

Change History (3)

comment:1 Changed 10 years ago by john

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/

comment:2 Changed 10 years ago by ubernostrum

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.

comment:3 Changed 9 years ago by addyosmani

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.

Note: See TracTickets for help on using tickets.