In Yii2 how to transfer data when you select select2 dependent select2 via AJAX?

Good afternoon all.
Colleagues tell me where in the code am I doing something wrong.
There is a form on the form, but Select2 from Kartik. Select points dependent, in the same brands of cars in the other models. By default, dependent select blocked for selection until the selected value of the first.

The problem is how to insert the data in the second select2?

The actual piece of code form with a widget:
<?= $form->field($model, 'auto')->widget(Select2::classname(), [
 'data' => $model->getMarksList(),
 'language' => 'EN',
 'options' => ['placeholder' => 'Select car brand ...'],
 'pluginOptions' => [
 'allowClear' => false,

],
 'pluginEvents' => [
 "select2:select" => "function() {
 var json = {\"id\":1,\"name\":\"alex\"};
console.log(json)
 $('#orderform-modelcar').prop('disabled', false);
 $('#orderform-modelcar').select2({data: json}); 
}"
],

 ])->label(null, ['class' => 'label']) ?>

 <?= $form->field($model, 'modelcar')->widget(Select2::classname(), [
 'data' => null,
 'language' => 'EN',
 'options' => ['placeholder' => 'Select model ...', 'disabled' => true],
 'pluginOptions' => [
 'allowClear' => false,
 ], 
 ])->label(null, ['class' => 'label']) ?>
April 2nd 20 at 17:34
0 answer

Find more questions by tags YiijQuery