Skip to content

Instantly share code, notes, and snippets.

@olivernn
Last active December 13, 2015 21:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save olivernn/4976860 to your computer and use it in GitHub Desktop.
Save olivernn/4976860 to your computer and use it in GitHub Desktop.
Using Davis.hash extensions
<!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