Posted By

crypticsoft on 03/28/11


Tagged

when tmpl deferred


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

scottwatkins


Deferred with $.when help and template example


 / Published in: jQuery
 

URL: http://stackoverflow.com/questions/4869609/how-can-jquery-deferred-be-used

  1. $.when( $.getJSON('/some/data/'), $.get('template.tpl') ).then(function( data, tmpl ){
  2.  
  3. $( tmpl ) // create a jQuery object out of the template
  4. .tmpl( data) // compile it
  5. .appendTo( "#target" ); // insert it into the DOM
  6.  
  7. });

Report this snippet  

You need to login to post a comment.