I have this form for a blog.
It works well with ajax no refresh, just serialize and submit data.
Then i decided using ckeditor 5 the value of the textarea isnt submitted.
my ajax script
$(document).ready(function(){
$("#create").click(function(event) {
event.preventDefault();
var form = $("#mytest");
var formData = new FormData($("#mytest")[0]);
$.ajax({
url : "test3.php",
type : "POST",
cache: false,
contentType : false,
processData: false,
data: formData,
success:function(response){
$(".test").html(response);
}
});
});
});
my html form
<form id="mytest" action="">
<input type="number" name="number" value="">
<br>
<textarea class="editor" name="textarea"></textarea>
<input type="submit" id="create" value="submit content">
</form>
<p class="test"></p>
my php code
$textarea = $_POST["textarea"];
$number = $_POST["number"];
echo $textarea;
echo $number;
2
Answers
Give the textarea an id of mycontent.
Thats the way i did it...
CKEditor wraps textarea in its own html markup, so in order to get that textarea text try:
In one of the earlier CKEditor versions I do