-1
我正在使用羽毛筆寫豐富的文本,並能夠從div讀取數據。但插入時沒有數據庫或代碼拋出的錯誤,但數據沒有進入數據庫。可以有人請幫我解決問題。如何在MySQL數據庫中插入格式化文本?
function addComment() {
var quill = new Quill('#comment');
var cc = quill.getContents();
var reqBody = {
"comment": cc
};
$.ajax({
type: "post",
data: JSON.stringify(reqBody),
url: "addcomment",
dataType: 'json',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json'
},
success: function(data) {
console.log(data);
},
error: function(e) {
console.log("ERROR : ", e);
}
});
}
<div id="standalone-container">
<div id="toolbar-container">
<span class="ql-formats">
<select class="ql-font"></select>
<select class="ql-size"></select>
</span>
<span class="ql-formats">
<button class="ql-bold"></button>
<button class="ql-italic"></button>
<button class="ql-underline"></button>
<button class="ql-strike"></button>
</span>
<span class="ql-formats">
<select class="ql-color"></select>
<select class="ql-background"></select>
</span>
<span class="ql-formats">
<button class="ql-script" value="sub"></button>
<button class="ql-script" value="super"></button>
</span>
<span class="ql-formats">
<button class="ql-header" value="1"></button>
<button class="ql-header" value="2"></button>
<button class="ql-blockquote"></button>
<button class="ql-code-block"></button>
</span>
<span class="ql-formats">
<button class="ql-list" value="ordered"></button>
<button class="ql-list" value="bullet"></button>
<button class="ql-indent" value="-1"></button>
<button class="ql-indent" value="+1"></button>
</span>
<span class="ql-formats">
<button class="ql-direction" value="rtl"></button>
<select class="ql-align"></select>
</span>
<span class="ql-formats">
<button class="ql-link"></button>
<button class="ql-image"></button>
<button class="ql-video"></button>
<button class="ql-formula"></button>
</span>
<span class="ql-formats">
<button class="ql-clean"></button>
</span>
</div>
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12" style="min-height:50px;" name="comment" id="comment" placeholder="Comment"></div>
<div class="col-lg-2 pull-right" style="top:5px;">
<button type="button" class="btn btn-info" name="submit" onclick="addComment()">Add</button>
</div>
</div>
請找出問題上面的代碼understanding.When我調用這個函數沒有插入到數據庫中的數據。
你的問題不清楚。好的,這不起作用,但我們如何猜測問題出在哪裏?向我們展示一些代碼,或者更好的,創建一個[Minimum,Complete and Verifiable example](https://stackoverflow.com/help/mcve) –
@EliasSoares我已經添加了代碼。請留下不完整的信息。讓我知道如果你需要關於此的任何其他信息。 –