2012-10-19 45 views
-1
$.post("http://localhost/academico/materias/getid", 
     ui.item.value, 
     function(data){ 
      console.log(data); 
     }, "json"); 

在我控制的變量$data變量總是空:數據POST'd蛋糕控制器沒有被綁定到功能

// $data is always null. How come? 
public function getid($data = null) { 
    debug($data); 
    // Como vamos a retornar solamente datos, no necesitamos el layout. 
    $this->layout = null; 

    $this->set('data', $data); 
    $this->render('/Elements/ajaxreturn'); 
} 

我怎樣才能得到POST'd的值綁定到我可以在Controller代碼中使用的東西?

+0

debug($ this-> data); –

+0

@MoyedAnsari:剛剛返回'array()'。 – sergserg

+0

does console.log(數據)顯示的東西? –

回答