简体   繁体   中英

jquery refresh div every second AND load a page with a get option

So basically i want to reload page every second and the page needs a get option so its loading the page like page.php?id=123

My code:

function autoRefresh_div(data){
  $("#refreshbtn").load($.get("btn.php"));
}
setInterval('autoRefresh_div()', 1000);

You can try this to get data with id:

function autoRefresh_div(id){
  $("#refreshbtn").load($.get("btn.php?id="+id));
}

setInterval(function(){ 
   autoRefresh_div(123); 
}, 1000);
setInterval(function() {
    window.location = 'page.php?id=123';
}, 1000);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM