I have a URL string like http://www.example.com/?chicken?toast
And I want to be able to store the values after each of the ? characters.
I have it working getting the last ?value - but cant seem to store the first...
Code that works to get the last ?value is:
window.lastValue = window.location.href.substring(window.location.href.lastIndexOf('?') + 1);
How can I store the first also?
So firstValue = chicken and lastValue = toast
UPDATE - How can I also store a totalVal by flattening the array? So, if the array was ["chicken", "toast"] I need this flattened into a string with a "." before each item in the array - so if the array was ["chicken", "toast"] it would become ".chicken.toast" - if the array was ["chicken"] it would become ".chicken" // thanks
Cheers,