Grow your CSS skills. Land your dream job.

I Don’t Get Asynchronous Updates

  • # June 8, 2009 at 12:39 pm

    So this code gets the latest ten dog photos from Flickr using jquery and json. But, how do I get it auto updating when a new photo is available (like twitter search). What are the steps involved?

    Code:

    # June 12, 2009 at 6:07 am

    Kinda simple, all you have to do is wrap the ajax call in a function and name it and call a setInterval() call like the following

    Code:

    every 3 seconds

    Second way to do it though more dirty is to wrap the entire code in the setInterval() like so

    Code:

    Either way the function has 2 parameters setInterval(function, time)
    note that the time is set in ms (3000 = 3 seconds, 500 = 1/2 a second, ect)

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".