Difference between #1 and #10 of
Update content in AJAX with renderPartial

Changes

Title changed

Update content in AJAX with partialRenderrenderPartial

Category unchanged

Tutorials

Yii version unchanged

Tags changed

AJAX

Content changed

The most easyeasiest way to update content in AJAX is to use the partialRenderrenderPartial method.

For this exemple I have three files: a controller (HelloWorldController.php) and two views (index.php and _ajaxContent.php)
[...]
```php
class Hello
WorldController extends CController
{
public function actionIndex()
[...]
<br />

*Note:  if using accessRules() in your controller file, you will need to modify accessRules() by adding the appropriate part of the function name to a rule set - in this case*  'updateajax'   *like this:*
 
 
array('allow',  // allow all users to perform 'index' and 'view' actions
 
'actions'=>array('index','view','updateajax'),
 
'users'=>array('*'),
 
),
 
 
 
 
#### views/helloWorld/index.php

```php
[...]
<?php echo CHtml::ajaxButton ("Update data",
CController::createUrl('hello
World/UpdateAjax'),
array('update' => '#data'));
?>
[...]
<br />

#### views/hello
World/_ajaxContent.php

```php
[...]
<br />

Now, run index.php?r=hello
World Enjoy!
 
 
 
### Links
 
 
- [Russian Version](http://dbhelp.ru/ajax-partialrender-update/page/)
43 0
46 followers
Viewed: 353 457 times
Version: 1.1
Category: Tutorials
Tags: AJAX
Written by: Burzum
Last updated by: hairylunch
Created on: Sep 30, 2009
Last updated: 11 years ago
Update Article

Revisions

View all history