Fixing issues with AJAX properties

Allowing to load data with ajax requests.

Example:

Widget:
´´
$this->widget('ext.ESelect2.ESelect2', array(
    'name' => 'choose-weapon',
    'options' => array(
        'minimumInputLength' => '3',
        'width' => '500px',
        'placeholder' => 'Select your Weapon',
        'ajax' => array(
            'url' => Yii::app()->controller->createUrl('inventory/searchWeapon'),
            'dataType' => 'json',
            'data' => 'js:function(term, page) { return {q: term }; }',
            'results' => 'js:function(data) { return {results: data}; }',
        ),
    ),
));
´´

Controller: 
´´
  public function actionSearchWeapon() {
        if (isset($_GET['q']))  {
                echo CJSON::encode(array('id' => '1', 'text' => 'My first Weapon')));
            }
        }
        Yii::app()->end();
    }
´´