I can not call the javascript function with the following javascript link. What is the problem here anyone can help me here please.
$buttonMessage = '
<a class="drupalchat-profile-un drupalchat_cng"
href="javascript:void(0)"
onclick="javascript:chatWith('.$pUsername.','.$profile_uid.','.$UserAvatar.','.$onof.')">
</a>';
asked Jan 29, 2018 at 10:55
AlwaysStudent
1,37421 silver badges53 bronze badges
1 Answer 1
You've probably some JS errors, and need to add single quotes around your values :
$buttonMessage = '
<a class="drupalchat-profile-un drupalchat_cng"
href="javascript:void(0)"
onclick="javascript:chatWith(\''.$pUsername.'\',\''.$profile_uid.'\',\''.$UserAvatar.'\',\''.$onof.'\')">
</a>';
answered Jan 29, 2018 at 10:57
Syscall
19.8k10 gold badges44 silver badges60 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
default
chatWithmethod and more of your php code'quotes