Hello.
In general, I had such a problem, when transferring data through php via ajax, they already come in recoded form.
I warn you in advance that all files are in my UTF-8 encoding!
Code about the following:
// javascript $.ajax({ type: "POST", url: "/comment/ajax/setContent/" + commentElement.id + "/" + value, success: function (reply) { console.log(reply); commentElement.querySelector(".comment-text").innerHTML = ""; commentElement.querySelector(".comment-text").innerHTML = reply; close(); } }); // php public function actionAjaxSetCommentContent($commentId, $content) { echo $content; Comment::updateComment($commentId, $content); return true; } As a result, if in JavaScript (e) I pass the string < p>Привет!< /p> then already in PHP, when I get this string through the $content variable, it turns into
% 3Cp% 3E% D0% 9F% D1% 80% D0% B8% D0% B2% D0% B5% D1% 82% 3C
Please help either to understand why such a transition occurs , or tell me what kind of encoding it is and how to overtake it on the php side back to normal!
echo rawurldecode('%3Cp%3E%D0%9F%D1%80%D0%B8%D0%B2%D0%B5%D1%82%3C');-><p>Привет<- Vismanurlis used to specify the address where we send, and for the data isdataapi.jquery.com/jquery.ajax/#entry-examples - Vismandataelement, but I see thevaluevariable. From here I think that you are trying to transmit the data through the address bar :) - Visman