how hide a element wiht ajaxLink?

i tried this with jquery syntax ? it didnt worked .

what is the correct syntax?




 <?php echo CHtml::ajaxLink("clickMe",

		  CController::createUrl('/HelloWorld/try'),

		  array('update' => '#erg', 'type' => 'GET', 'beforeSend' => "$('#wait').show()",

		  'complete' => "$('#wait').hide()"),







<div id="wait" style="display:None">

<h1> Hello </h1>

</div>




Firebug told me "beforeSend is not a function"


<?php echo CHtml::ajaxLink(

    'clickMe',

    '',

    array(

      'update' => '#erg',

      'type' => 'GET',

      'beforeSend' => 'function() { $("#wait").show(); }',

      'complete' => 'function() { $("#wait").hide(); }')); ?>

first check CHtml.ajaxLink()

and the jquery api

Don’t understand what do you do with update and think it’s wrong.

Secondly, what i think you only need for your purpose is




 <?php echo CHtml::ajaxLink("clickMe",

                  CController::createUrl('/HelloWorld/try'),

                  array('success' => "js: function() {

                   $('#wait').hide()")

                   },



had a mistake at function

It’s rather the question about jQuery than yii ;)

But it’s a jQuery.ajax() option…

Happy coding.