Just starting out with Javascript and ran into a problem when trying to execute a fetch within a fetch. Looking for a way to execute code once the first fetch completes. Using ‘then’ doesn’t seem to work as the call below to AjaxFileLoadInit() invokes a second fetch and locks things up. If I call AjaxFileLoadInit() later on after the first fetch has finished by way of a link everything works.

fetch(FileName)
.then(res => res.text())
.then(txt => Element.innerHTML = txt)
.then(txt => AjaxFileLoadJavaFix(Element))
.then(txt => AjaxFileLoadInit());

Thanks.