简体   繁体   中英

Dynamic change the tab content

在此处输入图片说明

I would like to know how to retrieve some new activity like the stackoverflow example? for example, if someone insert into the database, i can reflect it on the other user .

Also, if i want to dynamic change the tab content , such as when there is 1 new activity it is (1) title, i can simply using <title> <? echo $new; ?> title</title> <title> <? echo $new; ?> title</title> <title> <? echo $new; ?> title</title> ?

Thank you.

One way is to send Ajax request to poll periodically for any changes. The server side call will check for any new activities and send appropriate response such as number of activities. You can handle the response and update the title.

$.ajax({
  url: "get_update.php",      
  success: function(data){
    $(title).html(data); // data = "2 new activities"
  }
});

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