Problem CSS in loop when I using $.getJSON from external website
Hello,
I can't resolve this problem since 2 weeks...
After the get JSON I retrieve the data from the webService but when I try to display it, the css of Jquery mobile CSS doesn't work IN THE LOOP. And after the loop its works.
You can test this example, all is here. You will
easily undertand the problem.
- <!DOCTYPE html>
- <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
- <script src="http://code.jquery.com/jquery-migrate-1.1.1.min.js"></script>
- <link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.0/jquery.mobile-1.3.0.min.css" />
- <script src="http://code.jquery.com/mobile/1.3.0/jquery.mobile-1.3.0.min.js"></script>
- <script type="text/javascript" src="javascript_code.js"></script>
- <body>
- <div data-role="page" >
- <div data-role="content" data-theme="c" id="content_">
- <script>
- $.getJSON("http://api.flickr.com/services/feeds/photos_public.gne?tags=cat&tagmode=any&format=json&jsoncallback=?",
- function(data){
- $.each(data.items, function(i,item){
- /********function which execute code*******/
- //$("<img/>").attr("src", item.media.m).appendTo("#content_");
-
- });
- //When the loop is finished
- $('<p>Probleme of css :<input type="text" id="mail" /></p><p>password : <input type="password" id="password"/></p>').appendTo('#content_');
- });
- $('<p>Form ok :<input type="text" id="mail" /></p><p>password : <input type="password" id="password"/></p>').appendTo('#content_');
- </script>
-
- </div>
- <!-- /footer -->
- </div>
- </body>
- </html
Look the result, one work but not the second :
Very thanks for your help !!