когда я обновляю изображение файла в summernote, я использую функцию обратного вызова для обновления изображения.Все нормально.Но я отправляю форму, файл снова отправляется в запросах, я хочу отправить форму, а не отправлять файл снова.
$('.textarea-editor').summernote({
height: 300, // set editor height
minHeight: null, // set minimum height of editor
maxHeight: null, // set maximum height of editor
focus: true, // set focus to editable area after initializing summernote
callbacks: {
onImageUpload: function (files, editor, welEditable) {
sendFile(files[0], editor, welEditable);
}
}
});
function sendFile(file, editor, welEditable) {
data = new FormData();
data.append("file", file);
$.ajax({
data: data,
type: "POST",
url: "/Image/Upload",
cache: false,
contentType: false,
processData: false,
success: function (url) {
$('.textarea-editor').summernote('editor.insertImage', url);
//editor.insertImage(welEditable, url);
}
});
}