Example
fetch("be.php", {
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
method: "POST",
body: JSON.stringify({req:"put",url})
}
)
.then(response => {
if( response.ok ) {
console.log("ok")
window.location.reload()
}
return response.text()
}).then(text=> {
console.log(text)
})