我有一个带有输入和文本区域(ckeditor)的表单,在用ajax提交表单后,所有输入字段的值都被发送到数据库表,但ckeditor textarea除外,我不知道为什么!
我在这里用同样的问题try 了一些解决方案,但没有脉络!
HTML PART
<form id="submitForm">
... some inputs ...
<textarea class="form-control" name="details" rows="6" id="product-details"></textarea>
<button class="btn btn-solid btn-rounded" id='publish' type="submit"> SAVE </button>
</form>
JS PART
$(document).ready(function() {
ClassicEditor.create( document.querySelector("#product-details"), {
toolbar: {
items: [
"heading", "|",
"alignment", "|",
"bold", "italic", "strikethrough", "underline", "subscript", "superscript", "|",
"link", "|",
"bulletedList", "numberedList", "todoList",
"-", // break point
"fontfamily", "fontsize", "fontColor", "fontBackgroundColor", "|",
"code", "codeBlock", "|",
"insertTable", "|",
"outdent", "indent", "|",
"uploadImage", "blockQuote", "|",
"undo", "redo"
],
shouldNotGroupWhenFull: false
}
});
$("#submitForm").on('submit', function(e) {
e.preventDefault();
$.ajax({
type: 'POST',
url: 'ajax/create-product.php',
data: new FormData(this),
dataType: 'json',
contentType: false,
cache: false,
processData: false,
beforeSend: function() {
$("#publish").prop("disabled", true);
},
success: function(response) {
if (response.status == '1') {
Command: toastr["success"](response.message, "")
window.location.href = response.url;
} else {
$("#publish").prop("disabled", false);
Command: toastr["error"](response.message, "")
}
}
});
});
});