let myArray;
function getUsers() {
return new Promise(resolve => {
$.ajax({
method: 'GET',
url: 'https://jsonplaceholder.typicode.com/users',
dataType: 'json',
success: data => {
resolve(data)
}
})
})
}
async function test() {
myArray = await getUsers();
}
test();
document.querySelectorAll('input').forEach(item => {
console.log(item.value)
});
function getUsers() {
return new Promise(resolve => {
$.ajax({
method: 'GET',
url: 'https://jsonplaceholder.typicode.com/users',
dataType: 'json',
success: data => {
resolve(data)
}
})
})
}
let myArray = getUsers();
async function test() {
console.log(await myArray);
}
test();