var xhr = new XMLHttpRequest();
xhr.open("GET", "https://api-pacientes.heroku.com/pacientes");
xhr.addEventListener("load", function(){
if(xhr.status == 200){
var resposta = xhr.responseText;
var pacientes = JSON.parse(resposta);
pacientes.forEach(element => {
adicionaPacienteNaTabela(element);
});
}else{
console.log(xhr.status);
console.log(xhr.responseText);
}
});
xhr.send();