Use tmpl and load data from json
Hello,
When I use this code (page = #spectacle) :
- $('#spectacle').live('pagebeforecreate',function(event, ui){
- var movies = [{title: "The Red Violin", proch_date: "1998"}];
- $("#movieTemplate").tmpl(movies).appendTo("#test");
- });
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 :
- $('#spectacle').live('pagebeforecreate',function(event, ui){
- $.getJSON(url_thnet, function(datas){
- $("#movieTemplate").tmpl(datas).appendTo("#test");
- });
- });
Jquerymobile style isn't applied.
Do you have some idea about this problem ?
My template to test :
- <script id="movieTemplate" type="text/x-jquery-tmpl">
- <div data-role="header" data-theme="b">
- <h1>${title}</h1>
- </div>
- </script>
- <div id="test"></div>
Thanks !