redirect user to current page with some querystring using javascript

后端 未结 10 2014
無奈伤痛
無奈伤痛 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:42

    How about:

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

    or

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

    Etc...

提交回复
热议问题