jQuery/Javascript - reload current page with an appended querystring?

后端 未结 6 474
小鲜肉
小鲜肉 2021-02-03 18:40

I\'ve got a dropdown menu on my form, which when something is selected I need to reload the current page, but with an appended querystring.

How would I go about doing th

6条回答
  •  北恋
    北恋 (楼主)
    2021-02-03 18:55

    I was having a requirement to open a particular tab after reloading. So I just needed to append the #tabs-4 to the current url. I know its irrelevant to current post but it could help others who come to this just like I did.

    Using the code

    window.location = window.location.pathname 
                + window.location.search + '#tabs-4';
    

    did'nt work for me but below code did.

    location = "#tabs-4";
    location.reload(true);
    

提交回复
热议问题