I want to pass an array as url GET parameter and redirect to new page. I don't know how to pass an array with window.location.href. Is there any way in Ajax to redirect to new page with array as parameter(with or without window.location.href) or is there any other function for redirecting to other page in which I can pass an array as parameter from the front-end.
with jQuery $.param function you can convert array to http query
var data = {myArr: [1,2,3,4,5]};
console.log("index.php?" + $.param(data));
// index.php?myArr%5B%5D=1&myArr%5B%5D=2&myArr%5B%5D=3&myArr%5B%5D=4&myArr%5B%5D=5
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With