简体   繁体   English

带有'?x = y'查询的jQuery BBQ推送状态

[英]jQuery BBQ Push State with '?x=y' Query

I have been using http://benalman.com/projects/jquery-bbq-plugin/ push and react to URL's (AJAX loaded URLS)... 我一直在使用http://benalman.com/projects/jquery-bbq-plugin/推送并对URL的响应(加载AJAX的URL)...

Currently I have Urls like: 目前,我的Urls如下:

article/category/specific -> http://mypage.com/#article/category/specific
article/single/id -> http://mypage.com/#article/single/id

And so on, that works really well... 依此类推,效果很好...

Now I have the need to augment that further with some parameters like ?l=http://mypage.com/whereicamefrom 现在,我需要使用诸如?l = http://mypage.com/whereicamefrom的一些参数来进一步扩展它

This is for very specific situations where I wish that the user can store/bookmark the current url, but needs to know where that url started. 这是针对非常特定的情况的,我希望用户可以存储/添加当前URL,但需要知道该URL从何处开始。 Specifically when the URL changes by other means that the user clicking linkes etc... 特别是当URL通过其他方式更改时,意味着用户单击链接等。

Like performing a search, because searching would make the following url: 就像执行搜索一样,因为搜索将生成以下网址:

search/query -> http://mypage.com/#search/query

//I Would like (): 
search/query -> http://mypage.com/#search/query?l=article/category/specific
search/query -> http://mypage.com/#search/query?l=article/single/id
//(Depending on where you came from)

If I just try to pushstate with 'search/query?l=article/single/id' however, ? 但是,如果我只是尝试使用“搜索/查询?l =文章/单个/ id”来推送状态, gets transformed to '%3F'... 被转换为'%3F'...

DOH!!!!!! DOH !!!!!! Never mind... this didn't work due to another thing, i missed a "#" in the start of the hash I tried to push on page search... Ohh god... good thing that typing down your question can get your thoughts out of the circle your sitting in. 没关系...由于其他原因,此方法不起作用,我在试图推动页面搜索的哈希开头缺少一个“#” ...哦,天哪,键入您的问题可以让您的想法摆脱困境。

DOH!!!!!! DOH !!!!!! Never mind... this didn't work due to another thing, i missed a "#" in the start of the hash I tried to push on page search... Ohh god... good thing that typing down your question can get your thoughts out of the circle your sitting in. 没关系...由于其他原因,此方法不起作用,我在试图推动页面搜索的哈希开头缺少一个“#” ...哦,天哪,键入您的问题可以让您的想法摆脱困境。

So I pushed: 'search/query?l=article/single/id" Where I should have pushed: '#search/query?l=article/single/id" 所以我推送:'search / query?l = article / single / id“我应该推送的位置:'#search / query?l = article / single / id”

Then it works... (I feel a bit stupid now) 然后就可以了...(我现在有点傻了)

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

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