change

test.arr = new Array(1, 2, 3);

to

test["arr[]"] = new Array(1, 2, 3);

awkward, but should work..

On Dec 23 2008, 10:52 am, drimsun <stephane.cho...@gmail.com> wrote:
> Hello,
>
> Whenever I try to pass an object containing array data through jQuery
> AJAX only the
> last value of the array is sent. Consider this example:
>
> var test = new Object();
> test.arr = new Array(1, 2, 3);
> $.post("script.php", test, callback);
>
> If I print_r($_POST) in the script.php all I get is:
> Array ( [arr] => 3 )
>
> Instead of:
> Array ( [arr] => Array ( [0] => 1 [1] => 2 [2] => 3 ) )
>
> Any idea what's causing this? Thanks

Reply via email to