Use tmpl and load data from json

Use tmpl and load data from json

Hello,

When I use this code (page = #spectacle) :

  1. $('#spectacle').live('pagebeforecreate',function(event, ui){
  2.     var movies = [{title: "The Red Violin", proch_date: "1998"}];
  3.         $("#movieTemplate").tmpl(movies).appendTo("#test");
  4. });

That's work fine. There isn't problem to load page with Jquerymobile style.

But, when I try to load my data from json like that :

  1. $('#spectacle').live('pagebeforecreate',function(event, ui){
  2.     $.getJSON(url_thnet, function(datas){
  3.             $("#movieTemplate").tmpl(datas).appendTo("#test");
  4.     });
  5. });

Jquerymobile style isn't applied.

Do you have some idea about this problem ?

My template to test :

  1. <script id="movieTemplate" type="text/x-jquery-tmpl">
  2.     <div data-role="header" data-theme="b">
  3.         <h1>${title}</h1>
  4.     </div>
  5. </script>
  6. <div id="test"></div>
Thanks !