How to get separate values of array in javascript?
in one page:
var c=new Array(a); (eg: a={"1","2"}) window.location="my_details.html?"+ c + "_";
and in my_details.html :
my_details.htm:
var q=window.location.search;
alert("qqqqqqqqqqqqq " + q);
var arrayList = (q)? q.substring(1).split("_"):[];
var list=new Array(arrayList);
alert("dataaaaaaaaaaaa " + decodeURIComponent(list) + "llll " );
But i am not able to get individual array value like list[0] etc
How to get it?
thanks
Sneha
decodeURIComponent()
will return you aString
; you need to do something like:And then get it back out again:
This will use the value of
delim
as the delimiter to make theArray
aString
. We can then use the same delimiter to split theString
back into anArray
. You just need to make suredelim
is available in the scope of the second piece of code.