简体   繁体   English

自动在Rails 3中使用Ajax将新记录加载到页面中?

[英]Automatically loading new records into page with ajax in rails 3?

I'm trying to figure out how to load new records into a page through ajax (I assume) - think twitter or gmail. 我试图弄清楚如何通过ajax(假设)将新记录加载到页面中-想一下twitter或gmail。 Any ideas where to start with this one? 有什么想法从这个开始吗?

Also I'm using rails 3, and jquery 另外我正在使用Rails 3和jquery

Hugely deep topic, so I'll scope my answer to the start part. 主题很深,因此我将回答的范围限制在开始部分。

Start with loading new records on refresh. 从刷新时加载新记录开始。 This will take a fair bit of development as it is, because you have to track when you last loaded, how many records, are you close to hitting the API rate limiter (is there one), fetching only the new ones from the service and appending to the ones you already have. 这将需要一定的开发时间,因为您必须跟踪上次加载的时间,多少条记录,您是否即将达到API速率限制器(是否存在),仅从服务中获取新记录以及追加到您已经拥有的。

Once you've solved all of that and have a working page, we can start talking about how to do it through ajax. 一旦解决了所有这些问题并有了工作页,我们就可以开始讨论如何通过ajax进行操作。

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

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