FreiChat related discussions
Start chat per Button

Hello,
How can i start a freichat-chat with a button on a website?
Can someone give me an example?
Greetings from Germany

  • ddebrich
Hello, How can i start a freichat-chat with a button on a website? Can someone give me an example? Greetings from Germany - ddebrich

THANKS!!!!! smile
Can you maybe give me an example of code?
Because i only know html and php and i doesn't know how to make a button call the function
"FreiChat.create_chat_window_mesg(username, userid)"

THANKS!!!!! :) Can you maybe give me an example of code? Because i only know html and php and i doesn't know how to make a button call the function "FreiChat.create_chat_window_mesg(username, userid)"

You need to run the code in javascript .

For eg.
You can try running the code in developer console (f12 in chrome) .

Make sure the code is executed inside document ready .

We cannot give any specific examples as we do not have any information about your website.

You need to run the code in javascript . For eg. You can try running the code in developer console (f12 in chrome) . Make sure the code is executed inside document ready . We cannot give any specific examples as we do not have any information about your website.

Thanks for the fast help!
I do it like this:

<input type="button" class="buttons_dark" value="Nachricht senden" onClick="FreiChat.create_chat_window_mesg(username,user_id);">

i give the php variables to javascript like this:

<script type="text/javascript"><!--
var username ="<?php echo $username ?>";
var user_id ="<?php echo $user_id ?>";
</script>

Sorry for my bad english.
Thank you and have a nice day smile

Thanks for the fast help! I do it like this: ```` &amp;lt;input type=&quot;button&quot; class=&quot;buttons_dark&quot; value=&quot;Nachricht senden&quot; onClick=&quot;FreiChat.create_chat_window_mesg(username,user_id);&quot;&amp;gt; ```` i give the php variables to javascript like this: ```` &amp;lt;script type=&quot;text/javascript&quot;&amp;gt;&amp;lt;!-- var username =&quot;&amp;lt;?php echo $username ?&amp;gt;&quot;; var user_id =&quot;&amp;lt;?php echo $user_id ?&amp;gt;&quot;; &amp;lt;/script&amp;gt; ```` Sorry for my bad english. Thank you and have a nice day :)

Are you getting any errors in your browser console ?

Try doing something simple as:

<input type="button" class="buttons_dark" value="Nachricht senden" onClick="FreiChat.create_chat_window_mesg('admin',1);">
Are you getting any errors in your browser console ? Try doing something simple as: ``` &amp;lt;input type=&quot;button&quot; class=&quot;buttons_dark&quot; value=&quot;Nachricht senden&quot; onClick=&quot;FreiChat.create_chat_window_mesg(&#039;admin&#039;,1);&quot;&amp;gt; ```
150
5
0
live preview
enter atleast 10 characters
WARNING: You mentioned %MENTIONS%, but they cannot see this message and will not be notified
Saving...
Saved
With selected deselect posts show selected posts
All posts under this topic will be deleted ?
Pending draft ... Click to resume editing
Discard draft