JavaScript හි AJAX ඉල්ලීමක HTTP ප්රතිචාර කේතය
response ප්රතිචාරයේ status ගුණයෙහි
HTTP ප්රතිචාර කේතය අඩංගු වේ:
button.addEventListener('click', function() {
fetch('/ajax.html').then(response => {
console.log(response.status); // උදාහරණයක් ලෙස, 200
});
});
200 තත්ත්වයක් ලැබුණේ නම් පිටුවේ පෙළ මුද්රණය කරන්න,
404 තත්ත්වයක් ලැබුණේ නම් දෝෂයක් මුද්රණය කරන්න.