I am making changes in existing web page in yii2. I had this section of code:
Html::a('Confirm!',[
'default/apply',
'confirm' => 1,
'id' => $data->id
],['class' => 'btn-primary','data-method' => 'post'])
I have moved this to a different container on the same page.
(I had to adjust slightly, changing $data->id
into $projectInfo->id
as earlier it was inside anonymous function within a widget and now inside a foreach
loop. But this should not be relevant I suppose.)
Both before and after the change the same line is present in html (but in different part of the page):
<a class="btn-primary" href="/participant/default/apply/13/1" data-method="post">Confirm!</a>
But on execution http request is now sent as GET instead of POST.
BEFORE: "POST /participant/default/apply/13/1 HTTP/1.1"
NOW: "GET /participant/default/apply/13/1 HTTP/1.1"
I cannot figure out why this changed and how to get the code to work as POST in new location. This href execution must depend on some additional factor that I am not aware of.