Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

xmlhttprequest error handling

const xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
    if (this.readyState == 4 && this.status == 200) {
       console.log( xhttp.responseText );
    }
};
// Error Handling:
xhttp.onerror = function(error){
	console.error( error );
}
xhttp.open("GET", "filename", true);
xhttp.send();
 
PREVIOUS NEXT
Tagged: #xmlhttprequest #error #handling
ADD COMMENT
Topic
Name
8+3 =