Search code examples
javascriptjqueryrefreshreloadpartial-page-refresh

Refresh single div based on time delay


I'm using a Wordpress widget that displays the latest Forex currency information however the latest data is only loaded when the page is refreshed. I've noticed a few methods of refreshing a single div using jQuery and java but I haven't found a working solution for what I'm looking for.

The div ID is #sm_widget-2 and I'm looking for a 12 second delay before refreshing/reloading.

If anyone can shed some light on this for me I would be very greatful!


Solution

  • Here you go:

    setInterval(function()
    {
      $('#sm_widget-2').load(document.URL +  ' #sm_widget-2');
    }, 120000);