Home > Software design >  using async/await insted of AJAX
using async/await insted of AJAX

Time:02-16

I am going to use async await instead of AJAX in jsp file. How can I use async/await? This is my code:

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({});
        },
        one rror: function (d) {
            alert_g(eval(d));
        }
    });
}

CodePudding user response:

Instead of ajax you should use axios library for that and then use async and await accordingly for the Server request's.

Try this link for more understanding

  • Related