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>
Community
  • 1
  • 1
Rocoder
  • 1,083
  • 2
  • 15
  • 26
  • 2
    Why not store in session, and pass them. using sessionStorage – Dot_NET Pro May 22 '14 at 06: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](http://stackoverflow.com/questions/5554896/window-open-post) will help. – MisterBla May 22 '14 at 06: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. – ProllyGeek May 22 '14 at 07:00
  • @RichardA i will try this one this should solve the problem.. – Rocoder May 22 '14 at 07:02
  • 1
    @Rohit Also look at [this post](http://stackoverflow.com/questions/3951768/window-open-and-pass-parameters-by-post-method). – MisterBla May 22 '14 at 07:05
  • @RichardA link gonna make my work easier :) – Rocoder May 22 '14 at 07:11

1 Answers1

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
ProllyGeek
  • 15,517
  • 9
  • 53
  • 72
  • You'd be better off [NOT getting your information from W3S](http://www.w3fools.com/). – MisterBla May 22 '14 at 07:03
  • `/test/demo_form.asp?name1=value1&name2=value2` this is not good way as i already told it can contains thousands of values. – Rocoder May 22 '14 at 07:19