Created
December 11, 2014 18:17
-
-
Save jeff-hager-dev/4092236d8fbf29fbc3ce to your computer and use it in GitHub Desktop.
Playing around with a way to dynamically load handlebar templates. I know there are other ways to do it but I wanted to try myself.
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
(function(exports){ | |
layouts = { | |
'layoutName':'url-for-layout' | |
} | |
exports.layoutHelper = { | |
getLayout: function(layoutName){ | |
var layoutObj = ''; | |
$.ajax({ | |
url: layouts[layoutName], | |
type: 'GET', | |
async: false, | |
cache: false, | |
timeout: 30000, | |
error: function(){ layoutObj = ""; }, | |
success: function(data){ layoutObj = data; }, | |
}); | |
return layoutObj; | |
}, | |
} | |
})(window); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment