将json数据发送到php web服务

I am sending to the server this call:

var Message = {};
Message['islands'] = '1-15-13';
Message['newMessageText'] = 'this is test message';
$.ajax({
    url: "sendnote.php",
    type: "POST",
    data: Message,
    dataType: "json",
    contentType: "charset=utf-8",
    success: function (data) {
        alert(data["result"]);
    },
    error: function (data) {
        alert(data["result"]);
    }
});

and on server (sendnote.php) I have

print_r($_POST);

just to check do I receive anything, but after cchecking response in Firebug I see that this array is empty.

What am I doing wrong in sending data?

Thanks in advance!

PS I've checked previous post on this subject, but still have problems with it.

The problem is the contentType

Try this:

jQuery

$(document).ready(function(){
var Message = {};
    Message['islands'] = "1-15-13";
    Message['newMessageText'] = 'this is test message';

$.ajax({
        url: "sendnote.php",
        type: "POST",
        data: Message,
        dataType: "json",
        success:function(data) {
            alert("Islands: "+data.islands+", Message: "+data.newMessageText);
            },
        error:function(data) {
            alert('error');
        }  });
});

php

<?php
    echo json_encode($_POST);
?>

print_r($_POST) does not give a JSON response. do you even know what the actual reply of the request looks like when not using AJAX?

try echo json_encode($_POST); - this should print out a valid JSON.

or might i add that you might have forgotten PHP's <?php ?> opening and close tags