0
I’m trying to use Tinymce with Jquery but unsuccessfully, it sends the textarea data without formatting, if I try without Jquery it works, will Jquery not accept the html tags inserted by Tinymce?
Example part of html:
<script src="/tinymce/js/tinymce.min.js"></script>
<script>
$(document).ready(function () {
$("#btngravar").on("click", function () {
var form = $(this).parents("form");
var data = $(form).serializeArray();
$.ajax({
type: "POST",
dataType: "json",
url: "pagina.php",
data: data,
complete: function (json, status) {
// alert("passou");
},
success: function (json, status) {
alert("gravou");
},
error: function (json, status) {
alert("erro");
}
});
});
tinymce.init(
{
mode: "exact",
elements: "texto"
});
});
</script>
...
<form action="pagina.php" method="post">
<textarea id="texto" name="texto"></textarea>
<input type="button" id="btngravar" value="gravar"/>
</form>
Example part of PHP:
echo($_POST["texto"]);