【发布时间】:2016-02-17 04:06:57
【问题描述】:
我使用了 dropzone.js (http://www.dropzonejs.com/)。我正在尝试添加删除按钮来删除图像。但我收到 javascript 未定义错误
<script>
Dropzone.options.myDropzone = {
init: function() {
addRemoveLinks: true,
thisDropzone = this;
$.get('photo-add.php', function(data) {
$.each(data, function(key,value){
var mockFile = { name: value.name, size: value.size };
thisDropzone.options.addedfile.call(thisDropzone, mockFile);
thisDropzone.options.thumbnail.call(thisDropzone, mockFile, "upload/"+value.name);
});
});
this.on("removedfile", function(file) {
alert(file.name);
console.log(file);
// Create the remove button
var removeButton = Dropzone.createElement("<button>Remove file</button>");
/ / Capture the Dropzone instance as closure.
var _this = this;
// Listen to the click event
removeButton.addEventListener();
// Add the button to the file preview element.
file.previewElement.appendChild(removeButton);
});
}
};
</script>
【问题讨论】:
标签: javascript php jquery mysql