JSFiddle - React, Tailwind, and code Playground
JavaScript
function loadDoc() {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.write("<br/>OK: " + xhttp.responseText);
setTimeout(loadDoc, 3000);
}
};
xhttp.onerror = function() {
document.write("<br/>ERRO: readyState: " + xhttp.readyState + "status: " + xhttp.status + " responseText: " + xhttp.responseText);
};
xhttp.open("POST", "http://192.168.0.50/teste.php", true);
xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xhttp.send("fname=Henry&lname=Ford");
}
loadDoc();