如何通过将参数传递给URL来使用jQuery刷新页面 [英] How to refresh a page with jQuery by passing a parameter to URL
本文介绍了如何通过将参数传递给URL来使用jQuery刷新页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用jQuery刷新页面:
I am refreshing my page using jQuery:
location.reload();
这很好用,但是我想通过向URL传递参数来刷新同一页面.
This is working great but I want to refresh the same page by passing a parameter to URL.
如何使用jQuery做到这一点?
How can I do this by using jQuery?
例如:
如果我的网址是www.myweb.com
,我想通过传递这样的参数来刷新它
If my url is www.myweb.com
, I want to refresh this by passing a parameter like this
www.myweb.com?single
谢谢
推荐答案
您应该能够通过使用location.href
You should be able to accomplish this by using location.href
if(window.location.hostname == "www.myweb.com"){
window.location.href = window.location.href + "?single";
}
这篇关于如何通过将参数传递给URL来使用jQuery刷新页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文