Using jQuery, how do I way attach a string array as a http parameter to a http request?

Posted by predhme on Stack Overflow See other posts from Stack Overflow or by predhme
Published on 2010-06-01T15:18:05Z Indexed on 2010/06/01 15:23 UTC
Read the original article Hit count: 184

Filed under:
|
|
|
|

I have a spring controller with a request mapping as follows

@RequestMapping("/downloadSelected")
public void downloadSelected(@RequestParam String[] ids) {
    // retrieve the file and write it to the http response outputstream
}

I have an html table of objects which for every row has a checkbox with the id of the object as the value. When they submit, I have a jQuery callback to serialize all ids. I want to stick those ids into an http request parameter called, "ids" so that I can grab them easily.

I figured I could do the following

var ids = $("#downloadall").serializeArray();

Then I would need to take each of the ids and add them to a request param called ids. But is there a "standard" way to do this? Like using jQuery?

© Stack Overflow or respective owner

Related posts about java

Related posts about jQuery