Skip to content

Instantly share code, notes, and snippets.

Last active Aug 29, 2015
What would you like to do?
Loads an external HTML template inside a script tag.
(function($) {
// <script type="text/x-html-template" data-src="url" async></script>
$("script[type='text/x-html-template']").each(function() {
var $el = $(this);
var src = $'src');
if (!src) return;
url: src,
dataType: 'text',
async: $el.prop('async') || false,
cache: false,
success: function(data) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment