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

Revision #6 has been created by François Gannaz on Oct 18, 2013, 3:25:11 AM with the memo:

Fixed CJava*s*cript (PHP is case sensitive on classes but not on functions, pfff)
« previous (#5)

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: 180 210 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: 10 years ago
Update Article

Revisions

View all history