Skip to content

Instantly share code, notes, and snippets.

@henriquegogo
Created June 9, 2011 04:33
Show Gist options
  • Save henriquegogo/1016066 to your computer and use it in GitHub Desktop.
Save henriquegogo/1016066 to your computer and use it in GitHub Desktop.
Simple Sammy.js application
var app = Sammy('#content', function() {
this.use('Mustache');
this.get('#/', function(ctx) {
ctx.redirect('#/home');
});
this.get('#/home', function(ctx) {
var content = {user: 'henriquegogo', gender: 'male'}
ctx.partial('templates/home.mustache', user);
});
this.post('#/send', function(ctx) {
$.post('send.rb', ctx.params, function() {
ctx.redirect('#/home');
});
});
});
$(document).ready(function() {
app.run('#/');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment