Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
xhr.onreadystatechange = function() {
if (xhr.readyState === XMLHttpRequest.DONE) {
if (xhr.status === 200) {
if (cb){
cb(undefined,xhr.responseText);
}
} else if (error){
cb(xhr);
}
// Todo: else...?
}
};
xhr.open("POST", path, async); // Async
xhr.onreadystatechange = function() {
if (xhr.readyState === XMLHttpRequest.DONE) {
if (xhr.status === 200) {
if (cb){
cb(undefined,xhr.responseText);
}
} else if (error){
cb(xhr);
}
// Todo: else...?
}
};
xhr.open("POST", path, async); // Async