简体   繁体   中英

Is it possible to create a page showing database content in real time, updating without reload page in Drupal 7?

I have my custom module in Drupal and my custom page showing the content of a table of my own database. It is possible to refresh the content without reload page every X second? I need to know if it possible for I would want to save time trying to do something that is not possible.

You can use AJAX to reload the content of an element in the page every X seconds.

Since Drupal already includes jQuery you could do something like :

window.setInterval(function() {
  $('#myContentDiv').load('/url/to/my/database/content.php');
},timeInMilliseconds);

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