使用jQuery删除部分URL [英] Remove part of URL with jQuery
本文介绍了使用jQuery删除部分URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当所说的部分是可更改的时,如何使用jQuery删除URL的一部分?
How would I remove part of a URL with jQuery, when the said part is changeable?
例如我该如何从我的网址中删除它:?modal = name
E.g. how can I remove this from my URL: ?modal=name
当名称"可能是 name1 name2 或 name3
我想我需要分割URL,但是当模式名称可能是任何东西时,该怎么办?
I guess I will need to split the URL, but how do I do this when the modal name might be anything?
推荐答案
var url = 'http://yourdomain.com/search?modal=name';
alert(url.substring(0, url.indexOf('?')));
这篇关于使用jQuery删除部分URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文