Last active
December 14, 2015 19:49
-
-
Save krambuhl/5139824 to your computer and use it in GitHub Desktop.
Mustache/jQuery wrapper: Loads a mustache template via ajax: onsuccess, mustache template is rendered (on all matched contexts). if callback is defined, it will be called.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var renderTemplate = function(context, source, data, callback) { | |
$.get(source, function(template){ | |
$(context).html($.mustache(template, data)); | |
if (typeof callback === "function") | |
callback.call(this, context); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment