Created
November 3, 2012 22:30
-
-
Save ElemarJR/4009134 to your computer and use it in GitHub Desktop.
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> | |
| <head> | |
| <title>Sammy demo</title> | |
| </head> | |
| <body> | |
| <ul id='content'></ul> | |
| <form action='#/addLine' method='post'> | |
| <input type='text' name='msg'/> | |
| <button type='submit' name='submit'>send</button> | |
| </form> | |
| <script | |
| type="text/javascript" | |
| src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script> | |
| <script | |
| type="text/javascript" | |
| src="js/libs/sammy.js"></script> | |
| <script type="text/javascript"> | |
| $(function() { | |
| $.sammy(function () { | |
| this.get('#/contact', function(context){ | |
| var elem = $('<li>Going to contact page</li>'); | |
| $('#content').append(elem); | |
| }); | |
| this.get('#/aboutus', function(context){ | |
| var elem = $('<li>Going to about us</li>'); | |
| $('#content').append(elem); | |
| }); | |
| this.get('#/label/:name', function (context) { | |
| var elem = $('<li> label: ' + this.params['name'] + '</li>'); | |
| $('#content').append(elem); | |
| }); | |
| this.post('#/addLine', function (context){ | |
| var elem = $('<li>' + this.params['msg'] + '</li>'); | |
| $('#content').append(elem); | |
| }); | |
| }).run(); | |
| }); | |
| </script> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment