Created
June 9, 2011 04:33
-
-
Save henriquegogo/1016066 to your computer and use it in GitHub Desktop.
Simple Sammy.js application
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
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