Javascript - 使用不同的 QueryString 重新加载页面
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10602076/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Javascript - reload page with different QueryString
提问by Prasad Jadhav
I want to reload a page using JavaScript passing different parameters in URL.
我想使用 JavaScript 在 URL 中传递不同的参数来重新加载页面。
My Page name is test1.aspx, I used:
我的页面名称是 test1.aspx,我使用了:
window.location="test1.aspx?user=abc&place=xyz";
It's not working...!!!
它不起作用......!
回答by Elliot Bonneville
window.location
is an object. You need to access the href
property on it, like this:
window.location
是一个对象。您需要访问其href
上的属性,如下所示:
window.location.href="test1.aspx?user=abc&place=xyz";
回答by Moddasir
If you need to send dynamic value, then
如果您需要发送动态值,则
var user = "abc";
var place = "xyz";
window.location.href = "test1.aspx?user=" + user + "&place=" + place;
回答by hadi.sh
window.location = "path page?user=" + $("#txtuser").val();