我正在 sharepoint 2013 中开发 sharepoint 托管应用程序。我正在使用以下功能在 sharepoint 中上传文件。
self.UploadFile = function () {
// Suppose my business logic goes here
appWebContext.load(files);
appWebContext.executeQueryAsync(
function () {
alert("All files are uploaded.");
SP.UI.ModalDialog.commonModalDialogClose();
//SP.UI.ModalDialog.commonModalDialogClose();
//window.close();
},
function (error, errorMes) {
//SP.UI.ModalDialog.commonModalDialogClose();
//$("#btnMigrate").val("Migrate Class");
//$("#btnMigrate").removeAttr("disabled");
//alert(errorMes.get_message());
alert("Oooooops... it looks like something went wrong uploading your file.");
});
};
上面的代码工作正常。它显示消息“所有文件已上传”。然后它给出错误SP.UI.ModalDialog.commonModalDialogClose()
;在上面的代码SP.UI.ModalDialog.commonModalDialogClose();
中,当我调用函数时,appWebContext.executeQueryAsync
我收到错误“Javascript 运行时错误:函数未定义”。谁能告诉我如何从javascript中的异步函数更新UI?你能给我任何代码或链接吗?