The ok
property contains
true
if a server responded with
HTTP status
from the 2xx
group, and
false
if from another group:
button.addEventListener('click', function() {
fetch('/ajax.html').then(response => {
console.log(response.ok); // shows true or false
});
});
Output a text of a page if the request was successful, and an error if a bad status was received.