如何在哈希之前避免斜杠?

时间:2017-02-19 09:37:27

标签: javascript jquery html

我正在使用jquery-router-plugin并遇到问题。 我已经创建了一个带有这样的hashbang的Link标签:

<a href="#!/hello/world">Click</a>

并添加了这条路线(mainContent是一个简单的div):

$.router.add('/hello/:foo', function(data) {
    $("#mainContent").html("<b>Hello "+data.foo+"!</b>");
});

问题是浏览器调用它(不工作):

http://{url}/#!/hello/world

而不是这个(工作)

http://{url}#!/hello/world

如何让浏览器使用工作网址?

编辑1

当我点击它调用的链接时:

  

http://localhost/#!/hello/world

但它必须致电:

  

http://localhost#!/hello/world

0 个答案:

没有答案