Side navigation
#10292 closed bug (duplicate)
Opened September 16, 2011 10:54AM UTC
Closed September 16, 2011 02:40PM UTC
Last modified March 09, 2013 01:29PM UTC
ajax data cannot send empty array
Reported by: | tenev@enetpulse.com | 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.
Attachments (0)
Change History (6)
Changed September 16, 2011 10:58AM UTC by comment:1
Changed September 16, 2011 02:40PM UTC by comment:2
resolution: | → duplicate |
---|---|
status: | new → closed |
Changed February 10, 2013 06:47PM UTC by comment:4
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"]}
Changed February 10, 2013 06:53PM UTC by comment:5
Please do not attach unrelated bug reports to closed bugs.
Changed March 09, 2013 01:29PM UTC by comment:6
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: {}}
jsFiddle example of the bug http://jsfiddle.net/cjubX/