How can I include special characters in query strings?

后端 未结 7 940
日久生厌
日久生厌 2020-12-09 15:22

URL http://localhost/mysite/mypage?param=123 works fine. However, if I want to put some special characters in param, like ?, /

相关标签:
7条回答
  • 2020-12-09 16:10

    I did below, it works fine.

    const myQueryParamValue = "You&Me";
    const ajaxUrl = "www.example.com/api?searchText="+encodeURIComponent(myQueryParamValue)
    
    0 讨论(0)
提交回复
热议问题