You don't need to send the value of div-sharpeditor to input-sharpcontent to make ajax catch data and send it to php for processing.

I use the quill editor
he is editing text in the DIV area

<div id="editor" class="ql-editor"></div>
<input type="hidden" name="content" id="content">

ajax

$("-sharpform").submit(function(e){ 
// ...

var formData = new FormData($("-sharpform")[0]);

formData.append("content", document.querySelector(".ql-editor").innerHTML);

        $.ajax({
            type:"POST",
            url:"xxx.php,
            data: formData,
            enctype: "multipart/form-data",
            cache: false,
            contentType: false,
            processData: false,
            success:function(data){
                //...
            }
        });

I will first send the contents of ql-editor to content
in the list, and then process
to php, but now there is a problem because quill uploads content using base64
, so I make an error when I upload content to input value
because there is an attachment method of
, so there is no way to directly use
to use
on input"s value profile. How can I solve this problem?

In short,
how can I get ajax to catch data and send it to php for processing without having to send div-sharpeditor value to input-sharpcontent?


Why not consider separating the string from base64 so that it can be put into input?


I haven't used this editor, but in theory, you don't have to put the content in input. Adding a name attribute to-sharpeditor should get the form content normally

.
Menu