views:

51

answers:

2

Hi, I have a page where there are 117 input fields. What i want is to submit them via Jquery ajax. What i am thinking is to make an array and send them by this way. I would like to ask how is it possible to take all inputs and then to put them in an array and then retrieve them from the php file (for example, should i do explode,or for each..etc??) The input fields are not in a form (just in div with id = "config") Thanks.

+2  A: 

Stringify the data on the client side into JSON(there is a stringifier available here). Then, on the server-side use json_decode($json_str).

Another option is to put all those input fields into an actual form and then use jQuery's serialize() (which would actually be a whole lot easier).

Vivin Paliath
+2  A: 

Why not use .serialize(), along with an ajax POST? In PHP, they will all be accessible via the $_POST 'superglobal' array.

Andy E