Yii Framework Forum: how hide a element wiht ajaxLink? - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

how hide a element wiht ajaxLink? Rate Topic: -----

#1 User is offline   james2010 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 48
  • Joined: 19-February 10

Posted 05 June 2010 - 02:14 PM

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>


0

#2 User is offline   frantic 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 166
  • Joined: 01-March 10
  • Location:Saint-Petersburg

Posted 05 June 2010 - 03:09 PM

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(); }')); ?>

0

#3 User is offline   tydeas_dr 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 158
  • Joined: 16-April 10
  • Location:Greece

Posted 05 June 2010 - 03:51 PM

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

This post has been edited by tydeas_dr: 06 June 2010 - 06:07 AM

Follow me on twitter @dmtrsslvdr
Check my *new* blog @ tumblr
0

#4 User is offline   frantic 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 166
  • Joined: 01-March 10
  • Location:Saint-Petersburg

Posted 05 June 2010 - 04:17 PM

It's rather the question about jQuery than yii ;)
0

#5 User is offline   Luiz Celso 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 48
  • Joined: 13-April 12

Posted 21 June 2012 - 12:51 PM

View Postfrantic, on 05 June 2010 - 03:09 PM, said:

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(); }')); ?>



But it's a jQuery.ajax() option...

Happy coding.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users