从ajax获取数据

im trying to send data with ajax:

var id_cookie = read_cookie('replay_id');
id_cookie = JSON.stringify(id_cookie);
$.ajax({
        url: remote_ip+':8124/show_replay',
        data: {cookie: id_cookie},
        dataType: "jsonp",
        jsonpCallback: "start_replay",
        cache: false,
        timeout: 5000,
        success: function(data) {
            console.log("Received data: "+data);
            console.log(data);
        },
        error: function(jqXHR, textStatus, errorThrown) {
            alert('error ' + textStatus + " " + errorThrown);
        }
});

and when I receive it I want to access the data

else if (req.method === "GET") {

// do something with the sent data here. req.data is undefined. How can I reach it?

In PHP, to get the value of "cookie" as a GET parameter, you can use:

$_GET["cookie"]

If you're not sure if it will be GET or POST, you can use:

$_REQUEST["cookie"]

I'd probably change the name of the data you're sending from "cookie" to something less ambiguous, to avoid confusion with actual cookies.