Generate Widgets With Jquery

Hi guys,

Sorry about the misleading name, cant figure out how to change it :(

I am trying to create an autocomplete field by using jquery to call a controller function. (I cannot use widgets because my fields are dynamically generated by the user).

Currently I am getting a "the server responded with a status of 403 (Forbidden)" Error.

This is what I have:

index.php:




                $(document).ready(function(){

                    $("#name").autocomplete({

                        source: "<? echo Yii::app()->createUrl('jui/autocompleteTest');?>",

                        minLength:1

                    });

                });



JuiController.php




public function actionAutocompleteTest()

  {

    $res = array();

    if (isset($_GET['term']))

    {

// http://www.yiiframework.com/doc/guide/database.dao

      $qtxt = "SELECT CONCAT(name, '(' ,ticker,')') FROM alphanoo_portfolio.stock WHERE in_market='Active' AND ticker LIKE '%" . $_GET['term'] . "%' ORDER BY last_close desc LIMIT 10";

      $command = Yii::app()->db->createCommand($qtxt);

      $command->bindValue("name", '%'.$_GET['term'].'%', PDO::PARAM_STR);

      $res = $command->queryColumn();

    }

    echo CJSON::encode($res);

    Yii::app()->end();

  }



Any help is appreciated :)

Hi,

your view code is not reachable to your controller thats why its giving error. have you given any access rules for method calling :)