I have been using a short function in all my javascript routines to read text files on my local server
***
function XMLHttp(path) {
var request = new XMLHttpRequest();
request.open("GET", path, false);
request.send(null);
return request.responseText;
}
***
Works fine, returns the text, but keeps getting pinged as "deprecated" Is there a simple fetch function that could replace this...
I've messed with it and tried various sites for some insight. I get the console.log to registers the file but my 'returns' are always 'undefined' before the console.log fills...
***
function fetch1(path) {
fetch(path)
.then(response => response.text())
.then(textString => {console.log(textString);
return textString
});
}'
***
Thanks...