Javascript API
| Introduction This guide assumes that you have atleast basic knowledge of PHP. You must have access to your site template files in order to use this API. chatWith() function (Chat with me button) This function allows you to place a button on your site to launch chatbox with the specified USERID.
<a href="javascript:void()" onclick="javascript:jqcc.cometchat.chatWith('USERID');">Chat with me</a>
In the above code, USERID will have to be pulled dynamically depending on the user. For example, if your USERID is 1 and you would like all users to be able to chat with you, you can use a code like:
<a href="javascript:void()" onclick="javascript:jqcc.cometchat.chatWith('1');">Chat with site owner</a>
sendMessage() function (Force send a message from a user) This function allows you to send a message from the logged in user to any other user.
<a href="javascript:void()" onclick="javascript:jqcc.cometchat.sendMessage('USERID','MESSAGE');">Ping Me</a>
For example, if your USERID is 1 and you would like all users to be able to ping you, you can use a code like:
<a href="javascript:void()" onclick="javascript:jqcc.cometchat.sendMessage('1','PING');">Ping site owner</a>
You can use the above code to silently notify you when a user comes online. For example
jqcc(document).onready(function() {
jqcc.cometchat.sendMessage('1','I am online');
});
|



