problem with “&” sign when using ajax to post data to php

南笙酒味 提交于 2019-12-24 11:50:59

问题


i use tinyMce as my editor. everything is fine with sending content to save in database or echo it out. but when an ampersand sign "&" comes , all data after that truncated and dont save in database or echo out what should i do. here i have file , it's only 1kb, please download it, run it thank you everyone.

Download File

please if you could fine a way to get rid of "&" sign tell me and others how... .


回答1:


the problem is surely in the js. you should use encodeURIComponent() to send urlencoded information. as in

var parameters = 'message='+encodeURIComponent(message);

encodeURIComponent() on w3schools



来源:https://stackoverflow.com/questions/6986742/problem-with-sign-when-using-ajax-to-post-data-to-php

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!