Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- export async function asyncAjax(obj) {
- return await (function (){
- return new Promise((resolve) => {
- //
- obj.success = obj.success || function (res) {
- resolve({
- response: res,
- code: 200,
- });
- };
- //
- obj.error = obj.error || function (res) {
- resolve({
- response: res.responseJSON,
- code: res.status,
- });
- };
- $.ajax(obj);
- });
- })();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement