Skip to content

Instantly share code, notes, and snippets.

@dazld
Created February 20, 2012 19:16
Show Gist options
  • Save dazld/1870830 to your computer and use it in GitHub Desktop.
Save dazld/1870830 to your computer and use it in GitHub Desktop.
ICH Template Loading
loadTemplate: function(file,callback){
var that = this;
var partial = false;
if (file.indexOf('partial') !== -1) {
partial = true;
};
$.post('templates/'+file+'.tpl',function(e){
var s = document.createElement('script');
s.setAttribute('id',file);
s.setAttribute('type','text/html');
if (partial) {
s.setAttribute('class','partial');
};
s.innerHTML = e;
$("body").append(s);
ich.grabTemplates();
if (typeof(callback) === 'function') {
callback();
};
});
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment