Ryan Williams
Ryan Williams

Reputation: 75

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);

Upvotes: 2

Views: 72

Answers (2)

Bharatsing Parmar
Bharatsing Parmar

Reputation: 2455

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);

Upvotes: 3

Fab
Fab

Reputation: 668

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

Upvotes: 2

Related Questions