#10292 closed bug (duplicate)
ajax data cannot send empty array
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | undecided | Milestone: | None |
Component: | unfiled | Version: | 1.6.3 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
An empty array or an empty object cannot be send via jQuery.ajax()
to reproduce:
$.ajax({ url: 'test.php', type: 'post', data: {empty:[]}, });
In this case the "empty" array is not sent to the server.
Change History (6)
comment:1 Changed 12 years ago by
comment:2 Changed 12 years ago by
Resolution: | → duplicate |
---|---|
Status: | new → closed |
comment:4 Changed 11 years ago by
I can reproduce this bug again in 1.9.1.
In Javascript console, I do:
$.get("/items/do_work", {abc: []})
On server end (Rails), I get:
Started GET "/items/do_work?def=&ghi%5B%5D=3" for 127.0.0.1 at 2013-02-10 10:46:10 -0800 Processing by ItinerariesController#start_info_update as */* Parameters: {"def"=>"", "ghi"=>["3"]}
comment:6 Changed 11 years ago by
Their bug report was not unrelated and I am running into the same problem. jQuery 1.9.1 is not able to send "empty" objects like the following one via an ajax-request.
{abc: {}}
Note: See
TracTickets for help on using
tickets.
jsFiddle example of the bug http://jsfiddle.net/cjubX/