Passing two parameters in yii2 ajax request using jquery to a controller
<p>I have a link when pressed it requests a page from a controller via render ajax, Previously i used to pass only the id but now i would like to pass an extra parameter to the controller, how do i achieve this,
This is what i have tried</p>

<p>This is the link' which only passes a single parameter to the controller</p>

<pre><code>Html::a('click me', ['#'],
['value' =&gt; Url::to('checktruck?id='.$model-&gt;id), //this is where the param is passed 
'id' =&gt; 'perform']);
</code></pre>

<p>This is the controller code expecting 2 parameters:</p>

<pre><code>public function actionChecktruck($id,$category)  //it expects 2 parameters from above link
{
     $truckdetails = Truck::find()-&gt;where(['id' =&gt;$id])-&gt;one();

    if (Yii::$app-&gt;request-&gt;post()) {
      $checklistperform = new TodoTruckChecklist();
        $truck = Truck::find()-&gt;where(['id'=&gt;$id])-&gt;one();
        $checklistperform-&gt;truck_id=$id;
        $checklistperform-&gt;registered_by=Yii::$app-&gt;user-&gt;identity-&gt;id;
        $checklistperform-&gt;save();
        $truck-&gt;update();

        var_dump($checklistperform-&gt;getErrors());
        //var_dump($truck-&gt;getErrors());
    }
    else {
        $truckcategory = Checklist::find()-&gt;where(['truck_category'=&gt;$truckdetails-&gt;truck_category])-&gt;andWhere(['checklist_category'=&gt;$category])-&gt;all();
        return $this-&gt;renderAjax('truckyard/_checklistform', [
            'truckcategory' =&gt; $truckcategory,'truckvalue'=&gt;$id,
        ]);

    }

}
</code></pre>

<p>This is my jquery code of another button that depends on the above controller during post request</p>

<pre><code>$("#postbutn").click(function(e) {

   $.post("checktruck?id="+truckid,  //here i would like to pass 2 params
                {checked:checked,unchecked:unchecked,truckid:truckid}
            )
 }
</code></pre>

<p>This is the jquery code when there is no post</p>

<p>How can i pass an extra parameter in the link or even the $.post request for the controller </p>