是否有一种无插件的方式通过jQuery(或没有)检索查询字符串值?
如果是这样,怎么样?如果没有,是否有插件可以这样做?
可能重复:
如何获取查询字符串值?
我有以下网址:
http://www.mysite.co.uk/?location=mylocation1
Run Code Online (Sandbox Code Playgroud)
我需要的是location从URL 获取变量的值,然后在jQuery代码中使用它:
var thequerystring = "getthequerystringhere"
$('html,body').animate({scrollTop: $("div#" + thequerystring).offset().top}, 500);
Run Code Online (Sandbox Code Playgroud)
有谁知道如何使用JavaScript或jQuery获取该值?