Need to display Cgridview based on dropdownlist input ajax yii

Hey, i have trying to solve this problem for a week and i can’t understand what went wrong. I want to displaying cgridview based on the dropdownlist user input. I want to display the cgridview with ajax. With the dropdownlist data value used in cgridview dataprovider. i created something like this:

[b]base view (peserta.php)

[/b]




<?php $this->layout = 'column3';

?>

<h1 style="font-weight: bold;">List Peserta</h1>

<h5>Cari berdasarkan materi pelatihan yang diajarkan</h5>


<div class="form">




  <?php $form = $this->beginWidget('booster.widgets.TbActiveForm', array(

  	'id' => 'pengajar-form',

  	'enableAjaxValidation' => false,

    'htmlOptions' => array(),

  ));

  ?>


  <?php //echo $form->errorSummary($model); ?>


  <div class = "row">

  <?php

  echo $form->dropDownList($model,'idstatuspelatihan', Statuspelatihan::GenerateEntryList($id), 

    array(

          'empty'=> 'Pilih materi pelatihan',

          'ajax' => array(

                          'type' => 'POST', 

                          'url' => CController::createUrl('AjaxListPeserta'),

                          'data'=> array('idstatuspelatihan'=>'js: $(this).val()'),  

                          'update'=>'#datagrid',

   

                         )

    )

  );

  ?>

  </div>


  </br>


  <?php


  $this->endWidget();

  ?>


  <div id="datagrid"> 


      <!--CONTENT OF DISPLAYED CGRIDVIEW HERE-->


  </div><!--datagrid-->


</div><!--form-->



[b]Ajax view (ajaxlistpeserta.php)

[/b]




<?php     


    $this->widget('booster.widgets.TbExtendedGridView', array(

          'dataProvider' => $dataProvider,

          'filter' => '',

          'columns' => array(

              'idpeserta',

            ),

        ));

 ?>



[b]and the controller

[/b]




public function actionPeserta(){

	isAuth::pengajar();

	$id =  Yii::app()->user->getId();

	$model = new Statuspelatihan;


	$this->render('peserta', array('model'=>$model, 'id'=>$id));

}


public function actionajaxListPeserta(){


	$modelentry = new Pelatihanentry;

	$inputmateri = $_POST;


	$dataProvider = new CActiveDataProvider('Pelatihanentry', array(

			'criteria' => array(

				'condition' => 'idstatuspelatihan=:idstatuspelatihan',

				'params' => array(':idstatuspelatihan'=>$inputmateri),

				'with' => array('idpeserta0', 'idstatuspelatihan0'),


			),

		));


	$this->renderPartial('ajaxlistpeserta', array('dataprovider'=>$dataProvider) , false, true);


}




‘statuspelatihan’ in actionpeserta is a model used to display dropdownlist options based on the id of the user.

‘pelatihanentry’ is a model that i want to search and display based on the dropdownlist.

When i execute this code, yii always returning undefined variable: inputmateri error 500. what did i do wrong? please help me and enlightened me. I already search the solution everyday but i can’t understand it.

another thing that i don’t understand is how to passing data in in ajax’s dropdownlist to variable in controller. I don’t usually deal with js ajax and jquery. so basically i’m still a newbie with those language/framework. And this is my first yii app.

Thank you very much!:)