Javascript Chops URL

Intense Debate uses the following javascript code to display the comment number on my blog, which I have included in a handy little php function. By passing the id of a blog post to this php function, it creates a link to the comment section of that particular post.

function show_comments_number($id) {
$url="index.php?p=post&id=$id";
?>
<script>
var idcomments_acct = 'xxx';
var idcomments_post_id = '<? echo $id;?>';
var idcomments_post_url = '<? echo $url;?>';
</script>
<script type="text/javascript" src="http://www.intensedebate.com/js/genericLinkWrapperV2.js"></script>
<?}

      

The problem is that Intense Debate parses the URL I'm trying to pass, leaving after it and everything after it. So the Intense Debate link only produces "index.php? P = post" - obviously this is a problem.

Any ideas as to why it is hacking the URL this way?

0


a source to share


3 answers


Or follow the W3C recommendation and change and to a; (be sure to change your argument_separator.input and argument_separator.output accordingly).



0


a source


Most likely the & id in your url is being interpreted as invalid HTML entity. Wrapping the tag <script>

in comment ( <!--<script></script>//-->

) should help with this.



0


a source


Change &id

to &amp;id

and you should solve it.

0


a source







All Articles