redirect user to current page with some querystring using javascript

后端 未结 10 1915
無奈伤痛
無奈伤痛 2021-01-01 12:09

When a person clicks on a link, I want to do this:

  1. grab the text from a textbox
  2. encode the text
  3. redirect to currentpage.aspx?search=textboxva
10条回答
  •  借酒劲吻你
    2021-01-01 12:55

    you need to prepend the actual base url

    window.location.href = window.location.href + "?search=" + escape( $("#someId").val());
    

提交回复
热议问题