Reputation: 1141
I have an array like arr = ["1000","2000"].
I am converting this into comma separated value and then adding to my url.
Here I am converting to comma separated.
arr = arr.toLocaleString();
In my url, In chrome it is coming correctly but in IE it is coming %
before value.
Chrome : /1001,2000/
IE : /1001,%2000/
Url in IE is wrong. Anybody help me how to fix this.
Extra percentage is coming in url while checking in iE.
Upvotes: 2
Views: 269
Reputation: 100205
use .join() to join all elements of array into string ,and encode it, like:
var arr = ["1000","2000"],
str = arr.join(","),
encodedStr = encodeURIComponent(str); // "1000%2C2000"
Upvotes: 3