Bug Tracker

Opened 11 years ago

Closed 11 years ago

#4751 closed bug (invalid)

Post array data to server

Reported by: zhuzhe Owned by:
Priority: trivial Milestone: 1.4
Component: ajax Version: 1.3.2
Keywords: post data array Cc:
Blocked by: Blocking:

Description

I was trying to send a data in array format with post function.

var url = 'proc.php';

var data = {'data':[1,2,3,4,5]};

$.post(url,data);

php got

$_POSTdata? = 5;

instead of

$_POST['data] = array(1,2,3,4,5);

I know that

var data = {'data[]':[1,2,3,4,5]};

works for my destination.

but i really don't want write that kind of code.

and sending a string like

"data=1&data=2&data=3&data=4&data=5"

to server is meaningless,right?

Change History (1)

comment:1 Changed 11 years ago by dmethvin

Resolution: invalid
Status: newclosed

This is not a bug report. Please ask for help on a jQuery or PHP forum.

Note: See TracTickets for help on using tickets.