0

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?

3 Answers 3

2

This is explained here: http://www.slideshare.net/kakilang/how-to-submit-javascript-arrays-through-j-query-ajax-calls-t-presentation

Sign up to request clarification or add additional context in comments.

Comments

1

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

Comments

0

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(",");

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.