Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/85.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用Jquery BBQ获取哈希后的值_Jquery_Jquery Bbq - Fatal编程技术网

使用Jquery BBQ获取哈希后的值

使用Jquery BBQ获取哈希后的值,jquery,jquery-bbq,Jquery,Jquery Bbq,我使用Jquery BBQ是因为我想在url中的哈希之后获取值。因此,我: var url = $(this).attr('href'); console.log(jQuery.deparam.fragment(url)); 当我浏览日志时,我看到: Object 131: undefined __proto__: Object __defineGetter__: function __defineGetter__() { [native co

我使用Jquery BBQ是因为我想在url中的哈希之后获取值。因此,我:

            var url = $(this).attr('href');

            console.log(jQuery.deparam.fragment(url));
当我浏览日志时,我看到:

Object
131: undefined
__proto__: Object
__defineGetter__: function __defineGetter__() { [native code] }
等等

数字131是我想要的散列之后的值,我似乎无法得到它(我对Jquery非常陌生)。那么我如何得到这个值,在这个例子中是131?这可能很容易

来自:

jQuery.deparam.fragment([url][,强制])

从URL或 当前window.location,将其反序列化为对象, 可选强制数字、布尔值、空值和未定义值

返回:(对象)表示反序列化参数字符串的对象

因此,如果您只想将整个片段作为字符串,可以使用:

jQuery.param.fragment([url])

从URL或URL检索片段(哈希) 如果未传递任何参数,则返回当前window.location

返回:(字符串)已解析的片段(散列)字符串,带有任何前导“#” 删除


您是否尝试使用
jQuery.param.fragment(url)
而不是
jQuery.deparam.fragment(url)
?就是这样,谢谢!