Yii2 json - select 2 question !

Hi, I 'm using this extension http://demos.krajee.com/widget-details/select2 ; to generate a autocomplete . I want to do is that when you select any data of the auto complete , complete field autocomplete and additionally fill another area with another variable that was in the json .

this is my code

controller




         public function actionAuto($search = null, $id = null) {

    header('Content-type: application/json');

    $out = ['more' => false];

    if (!is_null($search)) {

        $query = new Query;

         $query->select(['prod_desc AS text', 'prod_codi AS id'])

        

            ->from('ge_tprod')

            ->where('prod_desc LIKE "%' . $search .'%" ' )

            ->limit(20);

        $command = $query->createCommand();

        $data = $command->queryAll();

        $out['results'] = array_values($data);

    }

    elseif ($id > 0) {

        $prod= GeTprod::find()->where(['prod_codi' => $id])->one();

        

        $out['results'] = ['id' => $id, 'text' => $prod->prod_desc, 'prod_valv' => $prod->prod_valv,];

    }

    else {

        $out['results'] = ['id' => 0, 'text' => 'error'];

    }

    echo Json::encode($out);

    

}



and the view





<?php





     // The controller action that will render the list

$url = \yii\helpers\Url::to(['/Facturacion/ge-tprod/auto/']);




// Script to initialize the selection based on the value of the select2 element

$initScript = <<< SCRIPT

  function (element, callback) {

    var id=\$(element).val();

    if (id!=="") {

       // alert('id not null' + id);

      \$.ajax("{$url}&id=" + id, {

        dataType: "json"

      }).done(function(data) { callback(data.results);});

    }

  }

SCRIPT;

 

// The widget

echo $form->field($model, 'prod_codi')->widget(Select2::classname(), [

    'language' => es,

    'options' => ['placeholder' => 'Buscar Producto ...'],

    'pluginOptions' => [

        'escapeMarkup' => new JsExpression("function(m) { return m; }"),

        'allowClear' => true,

        'minimumInputLength' => 3,

        'ajax' => [

            'url' => $url,

            'dataType' => 'json',

            'data' => new JsExpression('function(term,page) { return {search:term}; }'),

            'results' => new JsExpression('function(data,page) { return {results:data.results}; }'),

        ],

        'initSelection' => new JsExpression($initScript)

    ],


    'pluginEvents' => [

    'change' => 'function(){ $("#fcdetf-detf_valu").val();}'


    ]

]); 

?>



I do not know how to recover prod_valv that I have in the json and put in ‘change ’ = > ’ function () {$ ("# fcdetf - detf_valu " ) val ( ) . }’ so I put it in the field .

plis help