Skip to content

Instantly share code, notes, and snippets.

@andrewrk
Created September 9, 2012 20:46
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 andrewrk/3687164 to your computer and use it in GitHub Desktop.
Save andrewrk/3687164 to your computer and use it in GitHub Desktop.
<!doctype html>
<html>
<head>
</head>
<body>
<a href="/">home</a>
<a href="/create">create</a>
<script src="jquery-1.8.1.js"></script>
<script src="underscore.js"></script>
<script src="backbone.js"></script>
<script src="app.js"></script>
</body>
</html>
var MainRouter, Router;
MainRouter = Backbone.Router.extend({
routes: {
"": "index",
"create": "create"
},
index: function() {
console.log("index");
},
create: function() {
console.log("create");
}
});
jQuery(function() {
window.Router = Router = new MainRouter;
Backbone.history.start({pushState: true});
jQuery("a").on('click', function(e) {
e.preventDefault();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment