tags:

views:

30

answers:

1

By real time I mean where users don't have to hit refresh on the page. New content is automatically loaded onto the screen.

What are some examples of where you think this can be used and resources that show HOW to do it:

  1. Twitter real time updates via jquery
  2. SO feature to notify users that there were new answers as you are typing your answer (link?)

....?

A: 

You want to look into using a javascript library, like jquery, to dynamically load content into elements on your page.

Here is an example using jquery:

$(document).ready(function() {
     $("#yourElementId").load("generate_data.php");
   var refreshId = setInterval(function() {
      $("#yourElementId").load("generate_data.php");
   }, 60000);

This will update the element on the page with an id of "yourElementId" with the data generated from "generate_data.php" every minute (60000 milliseconds).

The generate_data.php script does the work of checking if there is data and which data to update the element with.

Additional Resources

Robert