Skip to content

Instantly share code, notes, and snippets.

@nathansmith
Created October 6, 2010 17:02
Show Gist options
  • Save nathansmith/613688 to your computer and use it in GitHub Desktop.
Save nathansmith/613688 to your computer and use it in GitHub Desktop.
// Example of how to cache the result of an external jQuery Template.
// Inspired by this post...
// http://encosia.com/2010/10/05/using-external-templates-with-jquery-templates/
var person = {name: 'Dave'};
var person_tmpl;
$.get('_template.tpl.html', function(template) {
// Use converted string from remote file.
person_tmpl = $.tmpl(template, person);
person_tmpl.appendTo('body');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment