Good morning. What should happen for onerror xhr to work? The server sometimes returns json data with a code of 500, and according to the logic in this case, onerror should occur, but onload occurs.
var requestError = function () { console.log("error", this); }; var xhr = new XMLHttpRequest(); xhr.open("POST", 'https://core.lotus-app.ru/1/' + method, true); xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); xhr.responseType = "json"; xhr.onload = success; xhr.onerror = requestError; xhr.timeout = timeout; xhr.vars = vars; xhr.send(paramToURL(params)); 
Status Code:200OKwith json, but 500. On a server, for example, php will look something like thisheader('HTTP/1.1 500 Internal Server Error');- Alexey Shimansky