js
var postData = $("#signUpMenu-form :input").serializeArray();
postData = JSON.stringify(postData);
$.ajax({
type: "POST",
url: "/main/class/classregister.php",
data: postData,
cache: false,
processData: false,
contentType: false,
success:function(data){
console.log(data);
console.log("suceess");
},
error: function(jqXHR, textStatus, errorThrown){}
});
php
$data = json_decode(stripslashes($_POST['postData']),true);
print_r($data);
I'm trying to use serializeArray
to send my form input data to php and get the data back, but somehow I can't get the data back at ajax.
What's wrong with my code?