AlwaysStudent
AlwaysStudent

Reputation: 1374

echo javascript function in php

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>'; 

Upvotes: 0

Views: 37

Answers (1)

Syscall
Syscall

Reputation: 19780

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>'; 

Upvotes: 3

Related Questions