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.
-Butler

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">
</div>

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.

<script>
 $(document).ready(function() {
 	 $("#responsecontainer").load("YourScript.php");
   var refreshId = setInterval(function() {
      $("#responsecontainer").load('YourScript.php');
   }, 9000);
   $.ajaxSetup({ cache: false });
});
</script>

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 to add loading gif at beging?

        How to load Whole page without Refreshing It.

How about load in it self page. I wanna modify this code :
.load("YourScript.php");

thank you

Just wanted to thank you for the tip !!! It works great ... thanks a lot ...

Thanks for shared great information. This information assist me

This post is very nice . I impress of this post. when i see this post , I am excited of your post.

Great information and best forum of information thanks

We are providing number of digital marketing services all over USA.

If you want whole page update and load without refresh the page so you can use JQUERY, jquery is part of javascript library , its very usefull for website.

Hi! Thanks for the advice!

Thanks for the tips.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.