Created
June 3, 2015 02:52
-
-
Save seajean/4dc8575892662ac635b5 to your computer and use it in GitHub Desktop.
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(){ | |
| var postData={title: "My New Post", content: "This is my first post!"}; | |
| getTemplate('template-1',postData).done(function(data){ | |
| $('body').append(data) | |
| }) | |
| }); | |
| function getTemplate( name,data){ | |
| var d=$.Deferred(); | |
| $.get(name+'.html',function(response){ | |
| var template = Handlebars.compile(response); | |
| d.resolve(template(data)) | |
| }); | |
| return d.promise(); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment