am new to yii2. I have been trying to send some parameters to an action from a view using the post method, unfortunately my action seems not to see/receive them. Help would be most appreciated.
my column action is something like this:
'buttons'=> [
'password'=> function ($url, $model, $key){
$url =$url = Url::toRoute(['users/reset-password', 'username' => $model->username]);
return Html::a('<span class="glyphicon glyphicon-asterisk"></span>',$url,[
'title'=>'Clave',
'data-confirm' => Yii::t('yii', 'Are you sure you want to change this password?'),
'data-method' => 'post',
'data' => ['username'=>$model->username, 'test-name'=>'this is just for testing'],
]);
},
.....
everything in the data parameter should be send by post, but I only get the csrf token .. thank you in advance for help.
use below code
echo Html::a('Name', ['controller/action'], [
'class'=>'classname',
'data'=>[
'method'=>'post',
'confirm'=>'Are you sure? OK to continue Retract..',
'params'=>[
'param1'=>'value',
.......,
],
]
]);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With