Submtting data using $.ajax and retrieving values from $_POST array
Posted
by
Linda Keating
on Stack Overflow
See other posts from Stack Overflow
or by Linda Keating
Published on 2014-06-01T21:01:54Z
Indexed on
2014/06/01
21:27 UTC
Read the original article
Hit count: 225
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.....
© Stack Overflow or respective owner