yii2 modal passing data

hello, I have a gridview where you have selected some lines that I would like to send to a modal window to be able to process them.

my view:




$script = <<< JS

$(function(){

  $('#btnAffido').click(function(){

      // recupero le righe selezionate

      pk= $('#gridPratiche').yiiGridView('getSelectedRows'); 

      if (pk != ''){

         $('.modal').modal('show')

            .find('#modelContent')

            .load($(this).attrs('value'));

      }

  });

});

JS;

$this->registerJs($script);

<?= Html::a('Create Pratiche', ['create'], ['class' => 'btn btn-success']) ?>



my controller




  /* Gestione Affido */

     public function actionAffido()

    {

        var keys = $('#grid').yiiGridView('getSelectedRows');

        $model = new AssegnazionePratiche();


        return $this->renderAjax('affido', [

            'model' => $model,

        ]);

    }



Any suggestions ? Thank you all