My Ajax Dont Work, Help Me!

Guys, my ajax dont work, and i dont know why… i see all good. Help me pls. :)

View:


<div class="row-fluid">

			<?php echo $form->labelEx($model,'nombreTour'); ?>

			<?php echo $form->dropDownList($model,'idTour', $busquedaTours, array(

				'disabled'=>$disabled,

				'ajax' => array(

					'type' => 'POST',

					'url' => $this->createUrl('UpdateAjax'),

					'data'=> array('idTour'=>'js: $(this).val()', 'idGuia'=>$model->idGuia),  

					'update'=>'#puesto',


					)

				)

				); //DROPDOWN DE TOURS ?>

				<?php echo $form->error($model,'idTour'); ?>

			</div>





	<?/*<div class="row-fluid">

		<?php echo $form->labelEx($model,'idGuia'); ?>

		<?php echo $form->textField($model,'idGuia'); ?>

		<?php echo $form->error($model,'idGuia'); ?>

	</div>*/?>




	<div class="row-fluid">

		<?php echo $form->labelEx($model,'puesto'); ?>

		<select id="puesto" name="Sueldos[puesto]" <?if($disabled)echo "disabled";?>>

			


			<?php

			if(empty($model->id)){

				?>

				<?php echo $form->error($model,'puesto'); ?>

				<?

				$data=Sueldos::items($model->idGuia, $model->idTour);

				$res = "";

				foreach ($data as $key => $value) {

					$res .= "<option value='".$value."'>".$key."</option>";

				}

				echo $res;

				?>

				<?php

			}else{

				?>

				<option value="<?=$model->puesto?>"><?=$model->puesto?></option>

				<?

			}

			?>

		</select>	

	</div>

Controller:





public function accessRules()

	{

		return array(

			array('allow', // allow admin user to perform 'admin' and 'delete' actions

				'actions'=>array('index','view','create','update','admin, updateAjax'),

				'roles'=>array('Gestor','Superusuario'),

			),

			array('deny',  // deny all users

				'users'=>array('*'),

			),

		);

	}




public function actionUpdateAjax()

    {	

 

	    $data=Sueldos::items($_POST["idGuia"], $_POST['idTour']);	    

	    $res = "";

	    foreach ($data as $key => $value) {

	    	$res .= "<option value='".$value."'>".$key."</option>";

	    }

	    echo $res;


    }

Whats is the problem? (AJAX DONT WORK)

Hi why you can write the ‘disabled’=>$disabled, on ajax call?

please see wiki

Also refer this forum

I hope it’s some help.

‘enableAjaxValidation’=>false,

true this parameter in form view. like this

‘enableAjaxValidation’=>true,

Hi,

Check with firebug (network section) if the ajax send request to the server

also check the response from server

$disabled is just a boolean, and ‘disabled’=>$disabled i’m calling out of ajax :P

I will try it and post. Anyway, thanks alot ;)

Yes, now working!

Was in form view: ‘enableAjaxValidation’=>true,

Thx all ;)