Reputation: 26016
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?
Upvotes: 0
Views: 1011
Reputation: 11
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
Upvotes: 1
Reputation: 26016
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(",");
Upvotes: 0
Reputation: 50293
This is explained here: http://www.slideshare.net/kakilang/how-to-submit-javascript-arrays-through-j-query-ajax-calls-t-presentation
Upvotes: 2