How to escape “&” ampersand character in form input using jQuery

后端 未结 5 1074
余生分开走
余生分开走 2020-12-30 06:00

I have a problem with my jQuery script that send data via POST method. The problem is whenever it sends data via Ajax that has an "&" ampersand in the sentence

5条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-30 06:40

    You could use 'encodeURIComponent' to accomplish the URL encoding for that component. I used this and validated with browsers IE, Firefox, and Chrome.

提交回复
热议问题