passing parameters to javacsript using php

Posted by ayush on Stack Overflow See other posts from Stack Overflow or by ayush
Published on 2010-06-10T20:00:00Z Indexed on 2010/06/10 20:02 UTC
Read the original article Hit count: 223

Filed under:
|

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. also i have tried the php with single quotes and double quotes but it is not working.

© Stack Overflow or respective owner

Related posts about php

Related posts about JavaScript