简体   繁体   English

Ruby on rails Ajax编辑URL?

[英]Ruby on rails Ajax Edit the URL?

这是我的问题,因为它很奇怪,我无法在上面找到任何东西,基本上我有一个带有分页的页面,因此内容包含页面,并且我正在通过ajax加载页面(因此不刷新),并且所有其中的一项找到了,但是我希望它编辑URL,以便如果有人刷新它,它将停留在他们所在的页面上(它不需要更改URL,而只是将它们保留在同一页面上的一种方式)

This is an age-old question about maintaining state in an ajax-enabled application. 这是关于在启用Ajax的应用程序中维护状态的古老问题。 There are many different approaches to solving it and most of them involve using anchor urls (example: http://yoursite.com/search_results#page2 ) and having your javascript dynamically build the page depending on which the anchor specified. 解决它的方法有很多,其中大多数涉及使用锚点网址(例如:http: //yoursite.com/search_results#page2 ),并让您的JavaScript根据指定的锚点动态构建页面。 I recommend giving this writeup a read-through: 我建议对此文章进行通读:

Doing links like Twitter, Hash-Bang #! 做像Twitter,Hash-Bang#的链接! URL's 网址

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

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