Skip to content

Instantly share code, notes, and snippets.

@cmilfont
Created July 27, 2013 20:11
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 cmilfont/6096119 to your computer and use it in GitHub Desktop.
Save cmilfont/6096119 to your computer and use it in GitHub Desktop.
//clicar no botao gerar um form
// mapear o submit do form
// enviar o json para o servidor
// exibir uma mensagem de volta
(function($){
var tpl = Mustache.compile("{{name}} created at {{created_at}}");
$.fn.extend({
create: function(config){
var $this = $(this);
$this.reveal();
$this.find("#graduate_button").click(function(){
var json = $this.getJSON();
config.controller.create(json, function(team){
$this.html( tpl(team) );
});
});
return false;
}
})
})(jQuery);
$("#bjjcreate").create( {controller: new TeamsController} )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment