【问题标题】:Error: Syntax error, unrecognized expression: #/(test)/test1,test2错误:语法错误,无法识别的表达式:#/(test)/test1,test2
【发布时间】:2015-10-06 23:47:45
【问题描述】:

我对 jQuery (1.11.2) 有疑问。我必须使用查询字符串中的参数构建 URL,如下所示: http://www.myhost.com/my/path/?search=ok#/(testA)/test1a,test2a/(testB)/testb1

但是jQuery返回给我“错误:语法错误,无法识别的表达式:#/(testA)/testa1,testa2”

我的代码:

$(document).ready(function() {
    var url = decodeURIComponent(document.location.href);
    console.log(url);
}

我没有发现问题,对于旧版本的 jQuery,这种类型的 URL 没有任何问题(我正在使用 eZ Publish 5)。

谢谢你的回答:)。

【问题讨论】:

    标签: jquery ezpublish querystringparameter


    【解决方案1】:

    H,

    错误原因是属性值中的特殊字符

    【讨论】:

    • 我的 URL 中需要“#”,因为此参数必须被视为锚标记,否则 eZPublish(CMS)将在“视图参数”中解释它们:)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-03-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-08-28
    • 2015-09-20
    • 2013-02-26
    相关资源
    最近更新 更多