$_post sends the data which 'arrives' at your PHP page as $_POST array elements. That's the nature of an HTTP post action. By indicating a 'json' datatype, the data your script returns will be expected to be in JSON form.
On Apr 12, 7:32 am, mcologne <blueameri...@web.de> wrote: > 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("<p>WE SEND THE EMAIL" + > res.message + "</p>"); > } > else if(res.result == 0) { > $('#dialog').html("<p>ERROR" + res.message + "</p>"); > }