我在页面http://www.sample.com/index.php
如何添加URL查询字符串。例如,当我点击按钮时,URL变为http://www.sample.com/index.php?value=10而没有页面重新加载。使用jquery ajax函数。
答案 0 :(得分:1)
我认为您正在寻找历史API,请查看此history.js
库,
https://github.com/browserstate/history.js
答案 1 :(得分:0)
新的HTML 5浏览器支持历史记录API(browser support,W3C spec):
window.history.pushState(stateObj, title, url);
在HTML 5之前的浏览器中,您可以设置哈希标记(browser support,W3C example)
window.location.hash = "state";
不支持更改哈希标记的较旧浏览器无法使用此功能。