Hi guys

Im wondering how it is possible to refresh the data on the page (read from php database), without having to refresh the whole page.

What i want i something similar to facebook and twitter, where it will say that new stuff has appeared. Instead of this though, i want it to just appear, instead of a box coming up with it appearing.

Instead of some messed up hard to understand guide, I would like a simple to understand, straight forward guide on how to do this,

Thanks guys.

5 Years
Discussion Span
Last Post by Gustavo_3

The following page gives an example: http://www.brightcherry.co.uk/scribbles/jquery-auto-refresh-div-every-x-seconds/. It uses JQuery which you can download from their official site http://jquery.com/. You can download the latest package, upload it to your site and change the location of the jquery .js file in the example. You may be able to use the "latest version" method that the example uses if JQuery still supports it.

<div id="responsecontainer">

You can change the name of the div's ID if you so choose but if you do change it then you need to change the two places in the code below where the div's ID is specified to match what you name the ID above.

 $(document).ready(function() {
   var refreshId = setInterval(function() {
   }, 9000);
   $.ajaxSetup({ cache: false });

Change the "YourScript.php" to the file which does the database querying and prints it out as you wish.

Read the first link for more details on the time until automatic refresh.

This will make whatever YourScript.php outputs available on the page load and then automatically refreshes it at the time you state for as long as the visitor remains on the page.


How about load in it self page. I wanna modify this code :

thank you

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.