php variable inside j.script function return [object Event]
Posted: Sun Jan 31, 2010 4:47 am
hello guys,
on my first load page, I call function init on php page like below
<script type="text/javascript">function initView('<? echo $username; ?>');</script>
whereby the php variable $username already declare on top...
but when im try to alert() the variable back in javascript..it return [object Event] which by mean javascript could not understand the php variable i guess.
Im thinking my parse on the variable could be wrong which i do not know how to play with ' and " to wrap the php variable properly on javascript function.
Could somebody do some correction on the code above?
Thanks!!
Azhan
on my first load page, I call function init on php page like below
<script type="text/javascript">function initView('<? echo $username; ?>');</script>
whereby the php variable $username already declare on top...
but when im try to alert() the variable back in javascript..it return [object Event] which by mean javascript could not understand the php variable i guess.
Im thinking my parse on the variable could be wrong which i do not know how to play with ' and " to wrap the php variable properly on javascript function.
Could somebody do some correction on the code above?
Thanks!!
Azhan