简体   繁体   English

jQuery-如何从上次请求的服务器URL获取URL参数?

[英]JQuery - How to get url params from last requested server url?

如何使用JQuery从上次请求的服务器URL 获取URL参数

previous url 上一个网址

document.referrer;

now you have previous url, you can get params from here 现在您有了以前的网址,您可以从这里获取参数

You can get the params from the query string, but that often has nothing to do with the last requested server URL. 您可以从查询字符串中获取参数,但这通常与上次请求的服务器URL无关。 One page can request hundreds of URLS from images to CSS and other JS files to template partials to hitting analytics and APIs. 一页可以请求数百个URL,从图像到CSS以及其他JS文件到模板部分,以访问分析和API。

You'd need to build an AJAX decorator that caches urls and then write a getter to fetch the most recently added one. 您需要构建一个AJAX装饰器来缓存url,然后编写一个getter来获取最新添加的装饰器。 Parsing the query string is trivial. 解析查询字符串很简单。 Checkout URI.js for an assistance lib. 检出URI.js以获取帮助库。

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

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