使用 [=e10=] 而不是 AJAX
using async/await insted of AJAX
我将在 jsp 文件中使用 async await 而不是 AJAX。如何使用 async/await?这是我的代码:
function setAcc(){
var acc_ = getDOM("acc_").value
AJAX.load({POST: {request: 'set_acc', async: false, acc_: acc_},
onSuccess: function (result) {
var objJSON = eval("(function(){return " + result + ";})()");
go({});
},
onError: function (d) {
alert_g(eval(d));
}
});
}
Instead of ajax you should use axios library for that and then use async and await accordingly for the Server request's.
尝试这个link以获得更多理解
我将在 jsp 文件中使用 async await 而不是 AJAX。如何使用 async/await?这是我的代码:
function setAcc(){
var acc_ = getDOM("acc_").value
AJAX.load({POST: {request: 'set_acc', async: false, acc_: acc_},
onSuccess: function (result) {
var objJSON = eval("(function(){return " + result + ";})()");
go({});
},
onError: function (d) {
alert_g(eval(d));
}
});
}
Instead of ajax you should use axios library for that and then use async and await accordingly for the Server request's.
尝试这个link以获得更多理解