简体   繁体   English

如何在没有回发的情况下更改同一页面上的查询字符串

[英]How to change the querystring on the same page without postback

I want to change the querystring on the page where I write notes. 我想在我写笔记的页面上更改查询字符串。 When I save the note I want the querystring to have the entry for that note. 当我保存笔记时,我希望查询字符串包含该笔记的条目。 So after the initial save the user can update based on the querystring. 因此,在初始保存之后,用户可以根据查询字符串进行更新。 But to update the querystring I need to do full postback. 但要更新查询字符串,我需要完全回发。 Is there anyway to change the querystring like this? 反正有没有改变这样的查询字符串?

No, you cannot change the current query string without reloading. 不,您无法在不重新加载的情况下更改当前查询字符串。 You could use the frgament portion of the url though ( # ). 你可以使用url的frgament部分( # )。 Setting the fragment portion might allow you to add some entries to the browser history without reloading. 设置片段部分可能允许您在不重新加载的情况下向浏览器历史记录添加一些条目。

For example if your current url is http://example.com/foo you could change it to http://example.com/foo#bar=baz without reloading the current page. 例如,如果您当前的网址是http://example.com/foo ,则可以将其更改为http://example.com/foo#bar=baz而无需重新加载当前网页。

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

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