I am wanting to url encode a string with Javascript, with the relevant part of the code being:
this.options[this.selectedIndex].value
or the full line:
<select name="category" onChange="javascript:document.location.href='<? echo '/' . $state . '/dir/'; ?>' + this.options[this.selectedIndex].value;">
How can I url encode this with JS and then safely decode it with PHP using urldecode
?