0

I need to pass a string array content through URL. The String array can contain 100 - 10000 values. I got the similar question link but problem in my case it contains large amount of data.

Using comma (,) is the best way to pass the values or is there any other way to solve this problem.

I am using this in javascript function where String array contains all the selected checkbox list values.

<script type="text/javascript">
function doResend(){
var checkboxes = document.getElementsByName('selectedId');
var vals = "";
for (var i=0, n=checkboxes.length;i<n;i++) {
  if (checkboxes[i].checked){
    vals += ","+checkboxes[i].value;
  }
}
if (vals){
vals = vals.substring(1);
window.open('resendSelectedSMS.do?smsId='+vals,"mywindow","status=1, height=335, width=400',resizable=0");
}else{
alert("Select atleast one id");
}
}
</script>
6
  • 2
    Why not store in session, and pass them. using sessionStorage Commented May 22, 2014 at 6:57
  • 3
    If I were you, I'd pass that as POST, instead of GET. POST can contain much more data than a GET can. Maybe this post will help. Commented May 22, 2014 at 6:58
  • Agree that post can send and fetch much more data , also it works in the background , no need to visualize your data , because sometimes you need to pass private ones. Commented May 22, 2014 at 7:00
  • @RichardA i will try this one this should solve the problem.. Commented May 22, 2014 at 7:02
  • 1
    @Rohit Also look at this post. Commented May 22, 2014 at 7:05

1 Answer 1

1

Best method is using get - post :

http://www.w3schools.com/tags/ref_httpmethods.asp

something that looks like that :

/test/demo_form.asp?name1=value1&name2=value2
Sign up to request clarification or add additional context in comments.

2 Comments

/test/demo_form.asp?name1=value1&name2=value2 this is not good way as i already told it can contains thousands of values.

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.