'why XMLHttpRequest too slow with my codes?
i code some simple form and decided to use XMLHttp Request to submit data to a php file but its seems is slow compared to using php. Is there anything i can do to make this fast. I'm getting mad at it because i have to hit the submit button like 3 times before the page moves to the next page
xmlr.open('POST', 'form/i.php');
var fnam = document.getElementById('firstname-input').value;
xmlr.onload = function () {
if (this.status === 200) {
function movON() {
window.location.href = "features.php"
}
setTimeout(movON, 1000);
} else {
console.log('error');
}
}
xmlr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;");
xmlr.send('&fxnam=' + encodeURIComponent(fnam) )
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
