Skip to content

Instantly share code, notes, and snippets.

@jackfranklin
Created May 8, 2013 09:15
Show Gist options
  • Save jackfranklin/5539270 to your computer and use it in GitHub Desktop.
Save jackfranklin/5539270 to your computer and use it in GitHub Desktop.
Really simple template loaded with jQuery.
var Template = function(opts) {
this.name = opts.name;
};
Template.prototype.load = function(cb) {
var self = this;
cb = cb || function() {};
var req = $.ajax({
url: "/templates/" + this.name + ".handlebars"
});
req.fail(function() {
throw("Could not load the template");
});
req.done(function(data) {
cb.call(self, data);
});
};
@foysalit
Copy link

foysalit commented May 8, 2013

looks neat. defo gonna use it from now on :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment