Skip to content

Instantly share code, notes, and snippets.

@bootcoder
Created July 21, 2014 22:59
Show Gist options
  • Save bootcoder/f09c7d9576afa2cdcb69 to your computer and use it in GitHub Desktop.
Save bootcoder/f09c7d9576afa2cdcb69 to your computer and use it in GitHub Desktop.
some Ajax
var handleBarListener = function() {
$(".ajax-private-profile-button").on("ajax:success", function(event, data, status, xhr){
console.log("INSIDE ajax-private-profile-button");
console.log(data);
$(".old-profile").fadeOut("slow");
setTimeout(function(){$(".private-profile-handlebars").fadeIn();}, 1000);
var templateIndexSource = $(".private-profile-template").html();
// debugger;
// console.log(templateIndexSource);
var template = Handlebars.compile(templateIndexSource);
// console.log(template);
// console.log(indexHTML);
var indexHTML = template({user: data});
// var indexHTML = template({user: data[0], user_games: data[1][0], user_groups: data[2][0], user_events: data[3][0]});
$(".private-profile-handlebars").append(indexHTML);
$(".private-profile-handlebars").hide();
}).on("ajax:error", function(){
console.log("Damn it Martha Jean Joe Bob, I thought I told you to format JSON!, ajax-private-profile-button ERROR");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment