Difference between #5 and #6 of
Javascript and AJAX with Yii

Changes

Title unchanged

Javascript and AJAX with Yii

Category unchanged

How-tos

Yii version unchanged

Tags unchanged

javascript, AJAX

Content changed

[...]
~
```php
echo $form->hiddenField($model, 'userId');

$quotedUrl = CJava
sScript::encode($this->createUrl(array('user/complete')));
$params = array(
'name' => "userComplete",
[...]
'ajaxUrl' => $this->createUrl('complete', 'id' => $model->id,
);
Yii::app()->clientScript->registerScript('variables', 'var myApp = ' . CJava
sScript::encode($vars) . ';'); ```~ Aside [CJavasScript::encode()], the method [CJavasScript::quote()] can also be useful. ~ ```php $url = $this->createUrl('app/ajaxProcessor'); $cs->registerScript('var1', "var myUrl = '" . $url . "';"); // can break with some URLs $cs->registerScript('var1', "var myUrl = '" . CJavasScript::quote($url, true) . "';");
```~


### 3. Final words
[...]
23 0
30 followers
Viewed: 182 033 times
Version: 1.1
Category: How-tos
Written by: François Gannaz
Last updated by: François Gannaz
Created on: Sep 30, 2012
Last updated: 11 years ago
Update Article

Revisions

View all history