Rocoder
Rocoder

Reputation: 1103

Best way to pass String array values through URL

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>

Upvotes: 0

Views: 963

Answers (1)

ProllyGeek
ProllyGeek

Reputation: 15836

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

Upvotes: 1

Related Questions