寻找一种使用 JavaScript/JQuery 将 URL 的哈希/片段中的键对解析为对象/关联数组的方法
Looking for a way to parse key pairs out of the hash/fragment of a URL into an object/associative array with JavaScript/JQuery
推荐答案查看:jQuery BBQ
jQuery BBQ 旨在解析来自 url(查询字符串或片段)的内容,并进一步简化基于片段的历史记录.这是 Yarin 在组装纯 js 解决方案之前一直在寻找的 jQuery 插件.具体来说, deparam.fragment() 函数完成这项工作.看看!
jQuery BBQ is designed for parsing things from the url (query string or fragment), and goes a bit farther to simplify fragment-based history. This is the jQuery plugin Yarin was looking for before he put together a pure js solution. Specifically, the deparam.fragment() function does the job. Have a look!
(我正在使用的支持站点使用异步搜索,并且因为 BBQ 使得将整个对象放入片段中变得微不足道,所以我使用它来保留"我的搜索参数.这为我的用户提供了他们搜索的历史状态,还允许他们为有用的搜索添加书签.最重要的是,当 QA 发现搜索缺陷时,他们可以直接链接到有问题的结果!)
(The support site I'm working on uses an asynchronous search, and because BBQ makes it trivial to tuck entire objects into the fragment I use it to 'persist' my search parameters. This gives my users history states for their searches, and also allows them to bookmark useful searches. Best of all, when QA finds a search defect they can link straight to the problematic results!)
更多推荐
使用 JavaScript 解析 URL 哈希/片段标识符
发布评论