Take the 2-minute tour ×

in my data object for the ajax call, i've got something like this:

data: {
    someVariable: []

and when I start the ajax call, I can see in the POST data that someVariable is not being sent.

  1. is this a mootools problem, or is it JS-wide?
  2. how can i intentionally send an empty array?
share|improve this question
add comment

2 Answers

I don't think you can send an empty array through an ajax call. You will need to come up with your own solution such as passing in array with an empty string[''] and handling that special case on the server side.

share|improve this answer
add comment
up vote 0 down vote accepted

While looking through a reported bug in the jquery bug tracker, they said the following:

The problem is that there is no way to serialize an empty array in a way that makes sense in the x-www-form-urlencoded format. foo[bar]= could either mean empty array, empty string, empty object, or null/undefined value, depending upon how the backend chooses to interpret it. Since neither way of serialization is really “correct”, and most backends interpret this as “empty string”, and this breaks traditional mode in quite a bad way (as per the forum thread), I’m marking this to block 1.6 so it can be reverted back to the old behaviour.



  1. it is a limitation of javascript

  2. no. what you can do is make a placeholder for an empty array where it is wrapped in quotes, like '[]' and on the server side, you can interpret that as a new empty array.

share|improve this answer
add comment

Your Answer


