Wednesday 10 August 2016

Yii2 href post – Post data using link tag



In Yii2, you can post data using link tag in a form with  data-method post, you can also pass data as params.


Example usage:
Html::a('<i class="fa fa fa-arrow-right"></i> Confirm Details', ['controller/action'], [
                        'class' => 'btn bg-blue btn-flat',
                        'data' => [
                            'method' => 'post',
                            'params' => [
                                'confirm-user' => '1',
                                'user_id' => '10',

                            ],
                        ]
                    ]);

No comments:

Post a Comment