ajax referesh clistview

Hi, I wrote the following cold. Please why the list doesn’t refresh/update?


<?php $model = new Ask; ?>


<?php $form=$this->beginWidget('CActiveForm', array(

   'id'=>'ajax-create-ask-form',

   'enableAjaxValidation'=>false,

)); ?>


<div class="row">

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

	<?php echo $form->textArea($model, 'title'); ?>

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

	</div><!-- row -->

	<div class="row">

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

	<?php echo $form->textArea($model, 'description'); ?>

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

	</div><!-- row -->

	div class="row">

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

	<?php echo $form->dropDownList($model, 'module_id', GxHtml::listDataEx(Module::model()->findAllAttributes(null, true))); ?>

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

	</div><!-- row -->

	<div class="row">

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

	<?php echo $form->dropDownList($model,'concept_id', GxHtml::listDataEx(Concept::model()->findAllByAttributes(array())), array('prompt'=>'Please select a department'));?>

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

	</div><!-- row -->

		

	<div class="row buttons">

		

	<?php echo CHtml::ajaxSubmitButton(

		Yii::t('forms', 'Create'), 

		CController::createUrl('ask/ajaxCreateAsk'),

			array(

				'type' => 'POST',

				'success' => 'function(){

					$("input[type=text], textarea").val("");

					$.fn.yiiListView.update("askList");

				}',

			)

		)?>

		

	</div>


<?php $this->endWidget(); ?>


<?php $this->widget('zii.widgets.CListView', array(

	'id'=>'askList',

	'dataProvider'=>$dataProvider,

	'itemView'=>'_view',

	'summaryText'=>'',

)); 

use firebug to see what the response the server output . seems that the success method doesn’t called





 'success' => 'function(){

                                       // $("input[type=text], textarea").val("");

                                        $.fn.yiiListView.update("askList");

                                }',




and trying comment the first line don’t let it interfere :lol:

Hi thx for your reply.

I am sure the success method called, because after I click the ‘submit’ button, and refresh the webpage (by press F5), I can see a new item is added to the list. And I tried to use alert(“asdf”) in the success call function, it works.

I really am confused about how $.fn.yiiListView.update works.

Looking forward to future help!!!!!!