Last active
September 3, 2017 16:38
-
-
Save khaosdoctor/9c043cf935e07a7ba214ecde82b82faf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var counter = 0 | |
function ajax() { | |
let xhr = new XMLHttpRequest() | |
// Abre a conexão para a página | |
xhr.open(‘GET’, ‘<URL>’) | |
xhr.onreadystatechange = () => { | |
counter += 20 // 20% pois são 5 estados | |
if (xhr.readystate === 4 && xhr.status === 200) { | |
console.log(xhr.responseText) // Aqui você tem sua resposta | |
} | |
}) | |
xhr.send() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment