How do I access AJAX data within a controller method? I have a JavaScript file which sends an array of data to a controller: 

Craft.postActionRequest('wineNotes/wineSpreadSheet/saveWines', data, ...)


The structure of the data variable is as follows:

var data = {
    Data: sData
}


... where sData is an array of temp variables sData(temp1,temp2,...) and the structure of each temp object is like this:

temp = {
    "wine":        ht.getDataAtCell(i,0),
    "country":     ht.getDataAtCell(i,1),
    "region":      ht.getDataAtCell(i,2),
    "note":        ht.getDataAtCell(i,3),
    "tastingdate": ht.getDataAtCell(i,4),
    "rating":      ht.getDataAtCell(i,5),
    "maturity":    ht.getDataAtCell(i,6),
    "conclusion":  ht.getDataAtCell(i,7)
};


How can I access the parameter temp.wine for each temp in the sData array within the following method of my controller?

public function actionSaveWines()
{
    // ???
}


I know the data structure is kinda wierd its actually an array of arrays. Read the below code and you might understand.

for(i=0;i&lt;NumRows;i++)
        {
            temp = {
                "wine":ht.getDataAtCell(i,0),
                "country":ht.getDataAtCell(i,1),
                "region":ht.getDataAtCell(i,2),
                "tastingdate":ht.getDataAtCell(i,3),
                "rating":ht.getDataAtCell(i,4),
                "maturity":ht.getDataAtCell(i,5),
                "conclusion":ht.getDataAtCell(i,6),
            };
            sData.push(temp);
        }

        var data = {
            Data: sData,
        }
        Craft.postActionRequest('wineNotes/wineSpreadSheet/saveWines', data, function(response) {


        });
Any properties of the object you pass into Craft.postActionRequest()’s second argument will be available to Craft as POST parameters, so you can get to them with HttpRequestService::getPost():

$sData = craft()-&gt;request-&gt;getPost('Data');

foreach ($sData as $temp)
{
    $wine = $temp['wine'];
    // ...
}