views:

167

answers:

3

I need to submit all selected JQGrid row ids to the server.

var rows = $("#grid").getGridParam("selarrrow");

Then on the server I would like to do this.

String[] rows =  request.getParameterValues("rows");

Now what is the simplest way to submit rows to the server? Must I use POST?

A: 

Thanks Konamiman, I opted for this,

$.ajax({
    type: "POST",
    url: "process.jsp",
    data: "rows=" + $("#grid").getGridParam("selarrrow"),
    success: function(){
        alert("submitted.");
    }
});

Then on the server I did this,

String[] rows =  request.getParameter("rows").split(",");
Rosdi
A: 

When comma comes in the values, server code will split this as two different value. So best way to send value is by creating questring value by looping all the rows. The link below has solved the similar scenario.

Source: http://lakhats.blogspot.com/2010/09/post-javascript-array-to-server-using.html

Lakhats