php - How do I refresh an HTML file when the contents of a different file change? -


i have situation device accessing simple mysql database using php. when search, results written in html file.

i have second device (very basic android tablet) has html file opened. using live.js refreshes when it's contents change. need this: static message saying "waiting search results" , when contents of page change results shown...

something this: on tablet load 1.html (waiting search results). when contents of page 2.html change (there search query), display (2.html). after push of button (user input), let's go 1.html , wait contents of page 2.html change again.

with live.js alone can watch file that's open...

any idea on how can achieve this? bunch.

[edit - solved] got work this: when user of tablet pushes button runs php script replaces contents of file (the previous search results) "waiting results" text. of course, has live.js in head, , when new search occurs, page reloads new search results.

it easier thought overthinking it.

the php script:

<?php ob_start();  $myfile = 'ana.html'; unlink($myfile); $fh = fopen($myfile, 'w') or die ("can't open file");  $stringdata =  '<html>   <head>   <title>rezultatele cautarii</title>    <link rel="stylesheet" href="style.css">    <script src="live.js"></script>   </head>   <body>    <h1 class="button">asteptam cererea</h1>   </body>  </html>';  fwrite($fh, $stringdata); fclose($fh);  header('location: '.$myfile);  die(); ?> 

do mean this?

document.write('<div id="loading"><br><br>please wait...</div>');   function addloadevent(func) {   var oldonload = window.onload;   if (typeof window.onload != 'function') {     window.onload = func;   } else {     window.onload = function() {       if (oldonload) {         oldonload();       }       func();     }   } }  addloadevent(function() {   document.getelementbyid("loading").style.display="none"; }); 

Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -