Last active
December 13, 2015 21:19
-
-
Save olivernn/4976860 to your computer and use it in GitHub Desktop.
Using Davis.hash extensions
This file contains 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>Davis tests</title> | |
<!-- dependencies --> | |
<script src="/tests/javascripts/jquery.js"></script> | |
<!-- davis --> | |
<script src="/davis.js"></script> | |
<script src="/extensions/davis.hash.js"></script> | |
</head> | |
<body> | |
<article> | |
<h2>Hash Links</h2> | |
<a href="#/eggs">eggs</a> | |
<a href="#/ham">ham</a> | |
<form action="#/cheese" method="post"> | |
<input type="submit" value="cheese"></input> | |
</form> | |
</article> | |
</body> | |
<script> | |
Davis.extend(Davis.hash) | |
var app = Davis(function () { | |
this.settings.generateRequestOnPageLoad = false | |
this.get('/eggs', $.noop) | |
this.get('/ham', $.noop) | |
this.post('/cheese', function (req) { | |
req.redirect('/ham') | |
}) | |
}) | |
</script> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment