Last active
February 12, 2016 19:24
-
-
Save spasiu/1170a706d43c34b2f1ef to your computer and use it in GitHub Desktop.
get name for smooch user
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <title>Document</title> | |
| </head> | |
| <body> | |
| <form class="name-collecting-form"> | |
| <input type="text" name="givenName" placeholder="given name"> | |
| <button>submit</button> | |
| </form> | |
| <script src="https://code.jquery.com/jquery-2.2.0.min.js"></script> | |
| <script src="https://cdn.smooch.io/smooch.min.js"></script> | |
| <script> | |
| $(document).ready(function() { | |
| $('.name-collecting-form').submit(function(e) { | |
| e.preventDefault(); | |
| init(e.target.givenName.value); | |
| }); | |
| }); | |
| function init(givenName) { | |
| Smooch.init({ | |
| appToken: '5nwcd6kl3maocv0n31mp4ymtt', | |
| givenName: givenName | |
| }); | |
| } | |
| </script> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment