Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Try </p> <pre><code> &lt;script&gt; var refreshId = setInterval(function() { $('#Hidden_Data').load('GetData.php', function() { // Shouldn´t this return $variables $('#Show_Data_001').fadeOut("slow").fadeIn("slow"); $('#Show_Data_002').fadeOut("slow").fadeIn("slow"); $('#Show_Data_003').fadeOut("slow").fadeIn("slow"); $('#...').fadeOut("slow").fadeIn("slow"); }); }, 5000); // Data refreshed every 5 seconds */ &lt;/script&gt; </code></pre> <p>Above is assuming, that your code returns snippet of HTML elements (Show_Data_XXX), but now that you've clarified your question above wont help you alone...</p> <p>What you need to do is either in your php send back new value elements or send back your results as data and update existing elements.</p> <p>Put your elements into a php Array and then send it back data.php after sql call </p> <pre><code>$results = Array(); while($row = mysql_fetch_array($result)){ $column1 = $row['column1 ']; // change Text1 in db to Show_Data_001 in html or vice versa $variable = $row['variable ']; $results[$column1] = $variable; } echo json_encode($results); </code></pre> <p>in your javascript something like this... </p> <pre><code>$.getJSON('GetData.php',function(data) { $.each(data, function(key, val) { $('#'+key).text(val); }); }); </code></pre> <p>I didn't put the fadeOut and fadeIn into the example, because it complicates it a bit. You could do fadeOut to all those elements before calling getJSON and the fadeIn as the results pouring in. Hope this helps</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload