JavaScript 新手在这里。
我正在尝试做这样的事情:
msls.showProgress($.ajax({
url: "/Web/DataImport.ashx",
type: "POST",
contentType: false,
processData: false,
data: file
}).then(
function success(result) {
// Do something
},function error(err) {
// Do something else
})));
基本上,我希望 LightSwitch 指示器显示,直到 ajax 调用返回。但是上面的代码不起作用,因为showProgress需要一个WinJS.Promise对象。
有人知道如何实现所需的行为吗?
你
试试这个:
msls.showProgress(msls.promiseOperation(function (operation) {
$.ajax({
url: "/Web/DataImport.ashx",
type: "POST",
contentType: false,
processData: false,
data: file
}).then(
function success(result) {
msls.showMessageBox(result);
},
function error(err) {
operation.error(err);
}))
})
);