Hi
I have this issue. I have tried many things but did not work…
On click of a button, after successful Ajax call, I want text fields to be clear.
Below is the code
<?php echo CHtml::beginForm()?>
<?php echo CHtml::activeLabel($model2, "Create Player")?>
<?php echo CHtml::activeLabel($model2, "email")?>
<?php echo CHtml::activeTextField($model2, “email”,array(‘id’=>‘foo’))?>
<?php echo CHtml::activeLabel($model2, "fname")?>
<?php echo CHtml::activeTextField($model2, “fname”,array(‘id’=>‘foo1’))?>
<?php echo CHtml::activeLabel($model2, "lname")?>
<?php echo CHtml::activeTextField($model2, “lname”,array(‘id’=>‘foo2’))?>
<?php echo CHtml::button(’+’,array(‘class’ => ‘tasks-add’))?>
<ul class="tasks">
</ul>
<div class="row buttons">
<?php Yii::app()->clientScript->registerCoreScript
("jquery")?>
[b] <script>
$(".tasks-add").click(function(){
$.ajax({
success: function(html){
$(".tasks").prepend(html);
},
type: 'post',
url: '<?php echo $this->createUrl('field')?>',
data: {
index:$("#foo").val(),index1: $(".tasks li").size()
},
cache: false,
dataType: 'html'
})
});
</script>[/b]
</div>
<?php echo CHtml::endForm()?>