Fetch (text)
fetch("php-file.php") //
.then((response) => { return response.text() }) //
.then((text) => {
alert(text); // show data displayed in the php file
//console.log(text); // log to the console
})
.catch((error) => {
console.log(error);
});