My JavasSript sends the request:
var jax = new XMLHttpRequest();
jax.open("POST", "http://localhost/some.php", true);
jax.setRequestHeader("Content-Type", "application/json");
jax.send(JSON.stringify(jsonObj));
jax.onreadystatechange = function() {
if(jax.readyState === 4) { console.log(jax.responseText); }
}
Right now all my php does is:
print_r($HTTP_RAW_POST_DATA);
print_r($_POST);
The output from the raw post data is the object string, but the post array is empty.
{"name" : "somename", "innerObj" : {} ... }
Array
(
)
I need to get it in the proper format for the $_POST
variable, and jquery isn't an option.