Easiest way to pass a javascript array or its values to a servlet and convert to a HashMap

Posted by Ankur on Stack Overflow See other posts from Stack Overflow or by Ankur
Published on 2010-04-20T02:52:00Z Indexed on 2010/04/20 2:53 UTC
Read the original article Hit count: 342

Filed under:
|
|

I have a Javascript array. I want to pass it's data to a servlet using the ajax() method of jQuery.

What is the easiest way to do this. The index values i.e. the i in array[i] are not in order, they are numbers that have meaning themselves, hence I cannot simply loop through and create a GET queryString, or so I believe.

Maybe I should be converting the JavaScript array to a JSON Object and sending that to the server ??

I am stumped on this one.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about arrays