最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Reload page with different QueryString - Stack Overflow

programmeradmin1浏览0评论

I want to reload a page using JavaScript passing different parameters in URL.

My Page name is test1.aspx, I used:

window.location="test1.aspx?user=abc&place=xyz";

It's not working!

I want to reload a page using JavaScript passing different parameters in URL.

My Page name is test1.aspx, I used:

window.location="test1.aspx?user=abc&place=xyz";

It's not working!

Share Improve this question edited Mar 24, 2023 at 21:57 Brian Tompsett - 汤莱恩 5,88372 gold badges61 silver badges133 bronze badges asked May 15, 2012 at 13:44 Prasad JadhavPrasad Jadhav 5,21816 gold badges64 silver badges80 bronze badges 1
  • possible duplicate of How can I make a redirect page in jQuery/JavaScript? – Alex Commented May 15, 2012 at 13:46
Add a comment  | 

3 Answers 3

Reset to default 14

window.location is an object. You need to access the href property on it, like this:

window.location.href="test1.aspx?user=abc&place=xyz";

If you need to send dynamic value, then

var user = "abc";
var place = "xyz";

window.location.href = "test1.aspx?user=" + user + "&place=" + place;
window.location = "path page?user=" + $("#txtuser").val();
发布评论

评论列表(0)

  1. 暂无评论