Hello;
I’ve been trying to send data via ajax using get method when I am in the controller action and try to dump the value of the parameters that are in the request they are all null. I don’t know what is wrong in my codes; Here down are them.
1.AJAX
$.get("http://localhost/kika/web/index.php?r=bien%2Ftuer&idplay=26&idcat=4");
2.Controller:
public function actionTuer($idplay,$idcat){
if(User::creator(Yii::$app->request->get('idcat'))){
var_dump(Yii::$app->request->get($idplay));//Printing null
var_dump(Yii::$app->request->get($idcat));//Printing null
$model = Play::findOne(Yii::$app->request->get($idplay));
if($model===null){
echo json_encode(array('erreur'=>'Not Found'));
Yii::$app->end();
}else{
if($model->delete()){
echo json_encode(array('reussite'=>'OK'));
Yii::$app->end();
}
}
}
echo json_encode(array('erreur'=>''));
Yii::$app->end();
}