简体   繁体   English

如何使用数据库中的更新来更新UI

[英]How do i update the UI with an update in the database

I am trying to make a user registration type of page but i am displaying the details of all the registered users on the page dynamically. 我正在尝试使页面成为用户注册类型,但是我正在页面上动态显示所有注册用户的详细信息。 Now suppose, I am trying to register using that page but some other user has already registered himself before me. 现在假设,我正在尝试使用该页面进行注册,但是其他一些用户已经在我之前进行了注册。 How do i update this, to the UI, dynamically? 如何动态更新到用户界面?

Is there any way to update the UI whenever a new entry is made in the database? 每当在数据库中创建新条目时,是否有任何方法可以更新UI?

You can use setInterval for call function after some interval. 间隔一段时间后,可以将setInterval用于调用函数。 then it will display Latest entry from database. 然后它将显示数据库中的最新条目。

setInterval(function() {
    your_function(); //call ajax function here
  },5000);

Hope it will help for you. 希望对您有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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