Q: CakePhP and jquery.getJSON how to pass data to controller I use jquery 1.8.3 and cakephp2, i have problem to pass data to controller by ajax this is my code: 
*.js
     $.getJSON("json/", {data: "somedata"}, function (data) {
        console.log(data['data']);
        d = data;
    }).error(function() { alert("error"); })

*controller.php:
public function json($site = null)
{
    $data = Array(
        "name" => $site,
    );
    $this->layout = 'ajax';
    $this->set(compact('data', $data));
}

view.ctp:
<?php 
    $this->autoRender = false;    
    echo json_encode(compact('data', $data)); 
?>

but in console name variable is null, anyone know how to do it right?
thx for any help!

A: try this in your controller:
return new CakeResponse(array('body' => json_encode($data)));

