我怎么能在“?”之前得到这个部分?使用jQuery的URL?
例如,我有以下网址:
http://example/group/abc/?author=gfg&city=gfg
我想得到这个:
http://example/group/abc/
如果网址是这样的:
http://example/group/abc/xyz?author=gfg&city=gfg
我想获得此网址:
http://example/group/abc/xyz
答案 0 :(得分:4)
没有jQuery必要。
window.location.href.split('?')[0]