[jQuery] ajax post data json - php receives only post data, no json
hi...
i have a normal email form, where the user can send an email with some
data...
at first i send it with normal post (no dataType in jquery)... but it
was difficult to handle the returning messages from php, e.g.
validation messages or ok messages...
therefor i tried dataType json... like the code below... now i con
better handle the returning messages, but i wonder why i still get
single post data in php ($_POST['name'], $_POST['email)'] etc and NO
nested json!... is there something wrong with my data format?
in firebug i also see only single post data... no json format when
posting
best regards
m, cologne
##############################
$.ajax({
type: "POST",
url: "/mail/process.php5",
data: {"name":name, "email":email, "message":message, "n":textmail,
"i":pic},
dataType: "json",
success: function(res) {
if(res.result == 1) {
$('#dialog').html("WE SEND THE EMAIL" +
res.message + "
");
}
else if(res.result == 0) {
$('#dialog').html("ERROR" + res.message + "
");
}