Submtting data using $.ajax and retrieving values from $_POST array
- by Linda Keating
I'm having trouble retrieving my form Data that has been submitted via ajax like this:
$( "form" ).on( "submit", function( event ) {
var formData = $(this).serializeArray();
console.log("fomData");
$.ajax({
url: window.location.origin+ "/selfservicemanager/localtmfsetup/local_tmf_setup.php",
type: "POST",
data: JSON.stringify(formData),
success : function (){
alert("success");
}
});
});
I can see the data being sent over the network like this:
But when I try to retrieve the data on the server side the $_POST array is empty.
<?php
var_dump($_POST);
die();
?>
array (size=0)
empty
Any ideas? I've tried to stringify the data being sent, and also tried to decode the $_POST array but it expects a string.....