yii2中对ajax的处理,传递yii2中的两个参数ajax请求使用jQuery到控制器

我有一个链接时,它通过渲染ajax从控制器请求一个页面,以前我曾经只传递id,但现在我想传递一个额外的参数控制器,我如何做到这一点, 这是我曾尝试传递yii2中的两个参数ajax请求使用jQuery到控制器

这是链接”只有传递给控制器​​

Html::a('click me', ['#'],

['value' => Url::to('checktruck?id='.$model->id), //this is where the param is passed

'id' => 'perform']);

这是控制器代码预计2个参数一个参数:

public function actionChecktruck($id,$category) //it expects 2 parameters from above link

{

$truckdetails = Truck::find()->where(['id' =>$id])->one();

if (Yii::$app->request->post()) {

$checklistperform = new TodoTruckChecklist();

$truck = Truck::find()->where(['id'=>$id])->one();

$checklistperform->truck_id=$id;

$checklistperform->registered_by=Yii::$app->user->identity->id;

$checklistperform->save();

$truck->update();

var_dump($checklistperform->getErrors());

//var_dump($truck->getErrors());

}

else {

$truckcategory = Checklist::find()->where(['truck_category'=>$truckdetails->truck_category])->andWhere(['checklist_category'=>$category])->all();

return $this->renderAjax('truckyard/_checklistform', [

'truckcategory' => $truckcategory,'truckvalue'=>$id,

]);

}

}

这是另一个按钮后请求期间取决于上述控制器上的我的jQuery代码

$("#postbutn").click(function(e) {

$.post("checktruck?id="+truckid, //here i would like to pass 2 params

{checked:checked,unchecked:unchecked,truckid:truckid}

)

}

这是jQuery代码时,有没有交

我如何可以传递一个额外的参数对于控制器