Ajax pagination and calls

Hi,

Please i have a problem with ajax pagination.

I have create an ajax pagination and it’s work but the problem is when i click on a page for the first time it create one ajax call, and if i click on it for second time it generate 2 ajax calls, and so…

for 3rd time -> 4 requests (the same ajax)

4th time -> 16 ........................

class MyPager extends CLinkPager {

        

     protected function createPageButton($label,$page,$class,$hidden,$selected)

     {

                if($hidden || $selected)

                        $class.=' '.($hidden ? self::CSS_HIDDEN_PAGE : self::CSS_SELECTED_PAGE);

                

                return '<li class="'.$class.'">'.CHtml::ajaxLink($label,$this->createPageUrl($page),array('update'=>'div#cahier','type'=>'POST','beforeSend' => 'function(){

								      $("div#cahier").addClass("ajaxloading");}',

						'complete' => 'function(){

								      $("div#cahier").removeClass("ajaxloading");}',)).'</li>';

    }

                

}

?>

3038

1.jpg

I found the answer here :http://www.yiiframework.com/wiki/178/how-to-avoid-multiple-ajax-request