I would like to send params via a link and POST method…
In Yii 1.x I could do the following:
echo CHtml::link( 'Link Text', Yii::app()->createUrl("controller/action"), array( 'submit'=>array('controller/action'), 'params'=>array('myParam' => $myParam) ) );
And Yii automatically generated JQuery code like:
But I could not figure out how to do it in Yii 2.
I looked in yii\grid\ActionColumn.php how it was done with the delete button…
but I could not get it to work with my link:
echo Html::a( 'Link Text', Url::to(['controller/action']), [ 'data-confirm' => "Want to submit?", // <-- confirmation works... 'data-method' => 'post', 'data-params' => 'myParam=anyValue' ] );
Is there a equivalent in Yii 2?
If yes: How to do it correctly?
Or do I have to write my own JQuery function for the links?
Thank you and best regards