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 = CJavasScript::encode($this->createUrl(array('user/complete')));
$params = array(
'name' => "userComplete",[...]
'ajaxUrl' => $this->createUrl('complete', 'id' => $model->id,
);
Yii::app()->clientScript->registerScript('variables', 'var myApp = ' . CJavasScript::encode($vars) . ';');
```~
Aside [CJava
sScript::encode()], the method [CJava
sScript::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 = '" . CJava
sScript::quote($url, true) . "';");
```~
### 3. Final words[...]