Passing parameters to Javascript using PHP
- by ayush
I have the following line of code:
<a href="javascript:;" onClick="tweeet('myid')">My Tweets!</a>
Now while this is working perfectly fine the following line is not:
<a href="javascript:;" onClick="tweeet(<?php echo 'myid'; ?>)">My Tweets!</a>
Can anyone help me out why it is not working and suggest any changes? The variable I want to pass to the Javascript function is a PHP variable. I have tried the PHP with single quotes and double quotes but it is not working.