I'm calling fetch a lot so I'm trying to make it a reusable function.
async function getXML(url) {
const result = await fetch(url);
const xml = await result.text().then(( str ) => {
return new DOMParser().parseFromString(str, 'application/xml');
});
log(xml); //logs fine
}
I call it from var xml = getXML(url).then( work_with_setup_xml(xml) );
The function 'work_with_setup_xml' starts without data. How far off course am I?