-5

大家好,我有一个看起来像这样的 URl

       http://localhost:60255/Roles/12/Users/

我需要使用窗口中的jquery从href中获取这个,我应该得到这个字符串

       http://localhost:60255/Roles/ 

从点击事件的 url

    this is what i had been trying

      var windowpathname = window.location.pathname; window.location.href = windowpathname + "Roles/" + RoleID + "/" + RoleName;   

在这种情况下,当我第二次点击

       http://localhost:60255/Roles/12/Rahul/Roles/14/Kishore/
4

2 回答 2

0

对象 window.location 的一些属性:

hash: ""
host: "fiddle.jshell.net"
hostname: "fiddle.jshell.net"
href: "http://fiddle.jshell.net/_display/"
origin: "http://fiddle.jshell.net"
pathname: "/_display/"
于 2013-04-14T20:17:54.833 回答
0

你可以试试这个

window.location.href = window.location.hostname + "/Roles/" + RoleID + "/" + RoleName;
于 2013-04-14T20:41:35.593 回答