本文介绍了如何更改地址栏中的网址?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我单击tabB时,我有一个带有两个标签的登录页面,我使用js并更新div
I have a landing page with two tabs when i click on tabB I use js and update div
$.get("/users", function(data) {});
$('.userTable').html("<%= escape_javascript render(:file => 'users/index.html.erb') %> ");
我如何也可以在地址栏中更改网址?每个选项卡都具有创建,编辑等功能,这也是我使用ajax进行的功能.如何更改地址栏中的网址以进行创建和更新?我检查了一些railscast,但没有人在谈论克鲁德.预先感谢您的帮助.
How I can change the url in address bar also?? Every tab has function like create, edit which is also I do using ajax. How I can change url in address bar for create and update?? I check some railscast but none of them is talking about crud. Thanks a ton in advance for help.
推荐答案
您可以使用历史记录操作api:
You can use the history manipulation api:
//Change address to http://www.test.com/page.php:
history.pushState('', '', 'http://www.test.com/page.php');
请参阅我该如何像GitHub一样进行很棒的无刷新页面更改?或 https://github.com/blog/760-the-tree-slider
这篇关于如何更改地址栏中的网址?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!