Rails 3:使用AJAX请求更新URL参数 [英] Rails 3: update URL params with AJAX request

查看:106
本文介绍了Rails 3:使用AJAX请求更新URL参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个过滤器和产品列表(id,名称,creation_date).

I have a filter and a list of products (id, name, creation_date).

我可以按ID,名称或creation_date进行过滤.借助AJAX请求,我更新了内容div ...但显然URL不变.

I can filter by id, name or creation_date. With an AJAX request I update a content div... but obviously the URL not change.

如何将参数附加到URL?例如:

How can I append params to URL? For example:

localhost:3000/dashboard/catalog?name=radio&?date_creation=23-06-2013

我知道history.pushState(html5)存在...但是我需要我的应用程序可以在像IE9这样的html4浏览器中正常工作.

I know that history.pushState(html5) exists... but I need that my app works in html4 browsers like IE9.

我尝试了Wiselinks( https://github.com/igor-alexandrov/wiselinks )它使用History.js,但不使用AJAX请求.

I tried Wiselinks (https://github.com/igor-alexandrov/wiselinks) which it uses History.js but it doesn´t use AJAX request.

有什么想法吗?

谢谢

推荐答案

最后,我遵循了这些RailsCasts教程:

Finally I follow those RailsCasts tutorials:

http://railscasts. com/episodes/240-search-sort-paginate-with-ajax?language = es& view = asciicast

http://railscasts.com/episodes/246-ajax-history-state?language = es& view = asciicast

这篇关于Rails 3:使用AJAX请求更新URL参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆