Difference between #2 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)
[...]
<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'));
?>
[...]
Now, run index.php?r=helloWorld

Enjoy!

 
 
 
### Links
 
 
- [Russian Version](http://dbhelp.ru/ajax-partialrender-update/page/)
43 0
46 followers
Viewed: 361 161 times
Version: 1.1
Category: Tutorials
Tags: AJAX
Written by: Burzum
Last updated by: hairylunch
Created on: Sep 30, 2009
Last updated: 12 years ago
Update Article

Revisions

View all history