So I have some php code that is generating links, and for the url I'm trying to pass the data to a javascript function.
echo "<a href=\"javascript:SubmitRemoval('", urlencode($item->roomname), "')\">Remove</a><br/>";
In the javascript function I am using this, but it does not seem to be removing the url encoding crap.
<script type="text/javascript">
function SubmitRemoval(roomname)
{
alert(decodeURI(roomname));
}
</script>
I'm开发者_开发百科 not really a javascript pro, is there a better way to do this?
I don't think this can work. You are encoding with PHP and trying to decode with javascript.
精彩评论