Javascript 上传后的触发功能
我在webix中实现了一个上传按钮。将触发事件Javascript 上传后的触发功能,javascript,webix,Javascript,Webix,我在webix中实现了一个上传按钮。将触发事件onBeforeFileAdd on: { onBeforeFileAdd: function(item){ var type = item.type.toLowerCase(); // deriving file extension if (type != "csv"){ // checking the format webix.message("Only csv files are allowed.");
onBeforeFileAdd
on: {
onBeforeFileAdd: function(item){
var type = item.type.toLowerCase(); // deriving file extension
if (type != "csv"){ // checking the format
webix.message("Only csv files are allowed.");
return false;
}
},
onUploadComplete: function(response) {
webix.message("done");
}
}
onUploadComplete
或onFileUpload
不起作用。我还放置了console.log
,但似乎不会触发这些事件。上载url响应状态代码200。只有在响应包含如下所示的对象时,onUploadComplete
事件才会触发:
{ status: 'server', sname:'some server name'};
Per:
回显“{状态:'服务器',sname:'$sname'}”
非常感谢。我看过这篇文章。没有明确提示您需要此响应结构来获取回调。。。所以我只是在寻找状态200(有没有任何原因导致它不能在状态200上启动?它不能启动的唯一原因是因为这就是他们编写API的方式,没有其他原因。你必须问作者。好的:)我只是想我已经了解了一些原因。