partially refresh in ajax

Can someone provide me a partially refresh code

http://www.yiiplayground.cubedwater.com/index.php?r=AjaxModule/ajax/ajaxRequest

thank, but can i do it with auto refresh with a timer

Yii::app()->clientScript->registerScript(‘test’, "

	$('.test').click(function(){


	$.fn.yiiGridView.update('records-grid', {


	data: $(this).serialize()

});

	return false;

});

	");

?>

<?php echo CHtml::link(‘refresh’,’#’,array(‘class’=>‘test’)); ?>

<div class="test" style="display:none">

</div><!-- test–>

this is my code, and i want it auto refresh with a timer, can i do that?

I don’t know if it’s really what you want, but you can deal with it in JS. You can use setTimeOut or setInterval like this (just an example, please adapt).

This snippet is adapted from this SO post


$(function() {

  setInterval(update, 1000);

});


function update() {

  $.fn.yiiGridView.update('records-grid', {

    data: $(this).serialize()

  });

  return false;

}