How to refresh a page with jQuery by passing a parameter to URL

后端 未结 9 1451
借酒劲吻你
借酒劲吻你 2020-12-13 17:04

I am refreshing my page using jQuery:

location.reload();

This is working great but I want to refresh the same page by passing a parameter t

9条回答
  •  轮回少年
    2020-12-13 17:54

    if window.location.hash is empty, you cant assign to location.href a new value without using a correct function (at least tested in chrome).

    try the window.location.replace:

    if (!window.location.hash) 
        {
            window.location.replace(window.location.href + "?single")
        } 
    

提交回复
热议问题