Bug Tracker

Opened 12 years ago

Closed 12 years ago

Last modified 11 years ago

#10292 closed bug (duplicate)

ajax data cannot send empty array

Reported by: tenev@… Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.6.3
Keywords: Cc:
Blocked by: Blocking:


An empty array or an empty object cannot be send via jQuery.ajax()

to reproduce:

   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 anonymous

jsFiddle example of the bug http://jsfiddle.net/cjubX/

comment:2 Changed 12 years ago by dmethvin

Resolution: duplicate
Status: newclosed

comment:3 Changed 12 years ago by dmethvin

Duplicate of #6481.

comment:4 Changed 11 years ago by anonymous

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 at 2013-02-10 10:46:10 -0800
Processing by ItinerariesController#start_info_update as */*
  Parameters: {"def"=>"", "ghi"=>["3"]}

comment:5 Changed 11 years ago by dmethvin

Please do not attach unrelated bug reports to closed bugs.

comment:6 Changed 11 years ago by m@…

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.