How to activate ajax-get injected html in jqm?
Hi,
in my jqm webapp i have the following problem:
i want to refresh my data-role page very x seconds. the refresh itself works fine, but its not in jqm-style.
here my index.php:
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8" />
- <title>Test App</title>
- <link rel="stylesheet" href="css/jquery.mobile-1.0a4.min.css" />
- <link rel="stylesheet" href="css/mymobile.css" />
- <script src="js/jquery-1.5.1.min.js"></script>
- <script type="text/javascript" src="js/mymobile.js"></script>
- <script type="text/javascript" src="js/jquery.ba-dotimeout.min.js"></script>
- <script src="js/jquery.mobile-1.0a4.min.js"></script>
- </head>
- <body>
- <div data-role="page" data-theme="b" id="result">
-
- <?php require('refresh.php'); ?>
-
- </div>
- </body>
- </html>
here my refresh.php:
- <div data-role="header">
- <h1>Test App <?php echo date('H:i:s');?> <div class="ui-icon-loading"></div></h1>
- </div>
-
- <div data-role="content">
- <ul data-role="listview" data-inset="true" data-theme="c" data-dividertheme="b">
- <li data-role="list-divider">Systems</li>
- <li class='status ok'>Heartbeats</li>
- <li class='status info2'>Alerts</li>
- <li class='status seriouserror'>SLA</li>
- <li class='status warning'>autom. Tickets</li>
- </ul>
-
- <ul data-role="listview" data-inset="true" data-theme="c" data-dividertheme="b">
- <li data-role="list-divider">Customer</li>
- <li class='status ok'>Kellogs</li>
- <li class='status warning'>Pepsi Cola</li>
- <li class='status ok'>Audi</li>
- <li class='status ok'>BMW</li>
- <li class='status ok'>Apple</li>
- </ul>
- </div>
and here ist my mymobile.js for timeinitiated refresh:
- $(document).ready(function() {
-
- $.doTimeout( 5000, function(){
- refresh();
- return true;
- });
-
-
- function refresh() {
- $(".ui-icon-loading").fadeIn();
-
- $.get("refresh.php", { },
- function(data){
- $('#result').html(data);
- $(".ui-icon-loading").fadeOut();
- });
- }
- });
I tried a lot, but i dont get it work correctly!
the first appearance is correct, but after 5 seconds, when it refreshs the page no jqm-style is available.
Any ideas?
Thanks for that & cheers
gentschi