Difference between #1 and #2 of
How to add ajax-loading indicators

Revision #2 has been created by rommanc on Sep 23, 2009, 11:53:49 AM with the memo:

Adding method for place array from previous version with ajax options (for more explanation)
« previous (#1) next (#3) »

Changes

Title unchanged

How to add ajax-loading indicators

Category unchanged

Tutorials

Yii version unchanged

Tags unchanged

Content changed

[...]
The advantage of this solution is, that you don't have to add extra markup to your page.

When performing the ajax request, add the .loading class to your, usually a div, element. And remove it when the request is complete.

```php
array(
 
 'ajax' =>
<?php 
 
 echo CHtml::form();
 
 echo CHtml::ajaxButton (
 
   'DoAjaxRequest', //label
 
    '', // url for request
 
   
array (    'beforeSend' => 'function(){      $("#myDiv").addClass("loading");
 
  
}',   'complete' => 'function(){      $("#myDiv").removeClass("loading");
 
  
}',    ) );
 
 echo CHtml::endForm();?>

```


The very slim CSS part of this recepie:
~~~
[...]
23 0
25 followers
Viewed: 59 860 times
Version: 1.1
Category: Tutorials
Tags: AJAX
Written by: schmunk
Last updated by: Yang He
Created on: Sep 4, 2009
Last updated: 5 years ago
Update Article

Revisions

View all history