ste*_*ris 4 javascript jquery get refresh query-string
我正在寻找一种方法来改变使用javascript(包含jquery)的html请求的获取查询字符串,而无需刷新页面.刷新时将继承此查询字符串.例如,http://thissite.site/index.html?id=123将是原始URL,然后发生事件并且id更改为235.刷新页面时,刷新的链接将是http://thissite.site/index.html?id=235.
window.location.search = "?id=" + encodeURIComponent(new_value)
Run Code Online (Sandbox Code Playgroud)
https://developer.mozilla.org/docs/DOM/window.location
https://developer.mozilla.org/docs/JavaScript/Reference/Global_Objects/encodeURIComponent
| 归档时间: |
|
| 查看次数: |
4157 次 |
| 最近记录: |