I have the following JavaScript code in the header of my page; note that I use POST:
function sendInput() {
var xmlhttp = new XMLHttpRequest();
xmlhttp.open('POST', 'http://.../somefile.php?someInput=123', true);
xmlhttp.onreadystatechange = function() {
if (this.readyState === 4) {
if (this.status >= 200 && this.status < 400) {
alert('ready: ' + xmlhttp.responseText);
}
}
};
xmlhttp.send();
}
I call the function in body onload:
<body onload="sendInput();">
In the PHP file $_POST is empty. The value for someInput is found in $_GET.
Shouldn't an AJAX request done with POST arrive in $_POST?