Good day. Can you please tell if the onerror event works in a synchronous request. Thank.
My code is:
var xhr = new XMLHttpRequest(); xhr.open('GET',"/customer/"+login,false); xhr.onerror = function(){ alert("XMLHttpRequest error"); console.log("XMLHttpRequest error"); authorizedCustomer = new Customer("Username","Password"); authorizedCustomer.authorities = [{"name":"ROLE_ADMIN"}]; alert(JSON.stringify(authorizedCustomer)); return; } xhr.send(); authorizedCustomer = JSON.parse(xhr.responseText); but, when working in the background (without communication with the server), the error code does not work.