let userList = '';
$.ajax({
type: "GET",
url: "api.api/users/",
headers: {
"Content-Type": "application/JSON",
},
success: function (res) {
usersList = res.result;
},
});
console.log(userList);
let userList = '';
const myAjax = (url, method = 'GET', headers = {}) => {
return new Promise(resolve => {
$.ajax({
method: method,
url: url,
headers: headers,
dataType: 'json',
success: resolve,
});
})
}
(async () => {
let data = await myAjax("https://jsonplaceholder.typicode.com/todos/");
userList = data;
console.log(userList);
})()