emi polak schrieb:
Hello,
I want to load some html content that changes over time, so I need to poll the server for changes from time to time. Could anyone point me to an example of how to do this? The documentation I found contains no example... I tried the following:

$.ajaxSetup( {
   timeout: 5000
 } );
$(document).ready( function() {
    $("#podcast_items").load("podcast_items_updater.php");
});

But the load does not fire again after those 5 seconds. I also tried including the ajaxSetup in the ready() block, and I also tried the deprecated (according to the manual) ajaxTimeout, but none of these seem to work.
The purpose of ajaxSetup is only setting global defaults for all ajax request. The timeout option is used to cancel request after some time, the documentation for $.ajax and $.ajaxTimeout should contain some more information about that.

What you need is something like this:

function request() {
        $("#podcast_items").load("podcast_items_updater.php");
}
setInterval(request, 5000);

If that doesn't yet do what you need: Have a look at the jHeartbeat plugin.

--
Jörn Zaefferer

http://bassistance.de

Reply via email to