JSFiddle - React, Tailwind, and code Playground
JavaScript
const urls = [
'https://dewnuf111111.com/configuration',
'https://dewnuf222222.com/configuration',
'https://bcsmania.co.uk/test.json'
];
let obj = {a: 'test'};
let counter = 0;
async function getConfigurations(urls) {
let result = null;
// Check for for last URL in the array
if (counter < urls.length) {
for(let count=0, len=urls.length; count <len; count++) {
try {
result = await fetch(urls[count])
}catch(e){}
if(result) break
}
}
return result
}
/* function getConfigurations() {
return ajax(urls[counter]);
} */
getConfigurations(urls).then((configurations) => {
console.log('DONE', configurations);
});