Skip to main content

Bug Tracker

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 anonymous comment:1

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

Changed September 16, 2011 02:40PM UTC by dmethvin comment:2

resolution: → duplicate
status: newclosed

Changed September 16, 2011 02:40PM UTC by dmethvin comment:3

Duplicate of #6481.

Changed February 10, 2013 06:47PM UTC by anonymous 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 dmethvin comment:5

Please do not attach unrelated bug reports to closed bugs.

Changed March 09, 2013 01:29PM UTC by m@luto.at 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: {}}