简体   繁体   English

Python、Postgres 和 Ajax/Jquery 使用数据库值实时更新页面

[英]Python, Postgres and Ajax/ Jquery update page realtime with databse values

I'm familiar with PHP and MySQL, however I need to find a way to update a web page each time a value changes in my database asynchronously, with a Python backend, a Postgres database, and maybe Jquery / Ajax to handle the asynchronous part.我熟悉 PHP 和 MySQL,但是我需要找到一种方法来在每次我的数据库中的值异步更改时更新网页,使用 Python 后端、Postgres 数据库,也许还有 Jquery/Ajax 来处理异步部分. I know MySQL doesn't support triggers on database changes and I believe Postgres does.我知道 MySQL 不支持数据库更改触发器,我相信 Postgres 支持。 Can anyone point me in the right direction?任何人都可以指出我正确的方向吗? I think polling would be a resource expensive method of doing this.我认为轮询将是一种资源昂贵的方法。

At a specific interval of time, send a jquery ajax request from client browser and get the latest data from server.在特定的时间间隔,从客户端浏览器发送一个 jquery ajax 请求并从服务器获取最新数据。 If data have been changed, then display the new data else leave it.如果数据已更改,则显示新数据,否则保留它。 You can do all this stuff in client side.你可以在客户端做所有这些事情。

Here is is the thread that explains setting timer and doing a ajax call.这是解释设置计时器和执行 ajax 调用的线程

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

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