¿Cómo recupero el tiempo de respuesta para una solicitud como esta?
let xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { } };Puede almacenar el tiempo antes de la solicitud, obtener el tiempo después de que finalice la solicitud y restar los dos para obtener la diferencia:
const before = new Date(); var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { const now = new Date(); const diff = now - before; console.log("Took " + diff + " milliseconds"); } };