Skip to content

Instantly share code, notes, and snippets.

@carlosrberto
Forked from nathansmith/jq_template_example.js
Created February 24, 2012 01:22
Show Gist options
  • Save carlosrberto/1896523 to your computer and use it in GitHub Desktop.
Save carlosrberto/1896523 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