Error 400 Invalid YII request to delete record

I am trying to delete an entry in Yii that causes a 400 error. Retry this request again. It checks the post variable, my controller file has
if(Yii::app()->request->isPostRequest)
When I repeat my post variable empty, while $ _GET has the identifier I want to delete, my View file looks,

echo CHtml::link(CHtml::encode('Delete image'), array('image/delete', 'id'=>$image->id), array('class' => 'delete','confirm'=>'This will remove the image. Are you sure?'));

Access rules have deletion for authenticated users, which is correct. Tried this too *. I also tried sending it as a hidden variable, but nothing good.

It is impossible to figure out how I can submit the form in Yii.

+5
source share
4 answers

, . CHtml::link , post, get. submit clientChange htmlOptions.

:

echo CHtml::link(CHtml::encode('Delete image'), array('image/delete', 'id'=>$image->id),
  array(
    'submit'=>array('image/delete', 'id'=>$image->id),
    'class' => 'delete','confirm'=>'This will remove the image. Are you sure?'
  )
);
+15

Curd ,

/**
 * @return array action filters
 */
public function filters()
{
    return array(
        'accessControl', // perform access control for CRUD operations
        'postOnly + delete', // we only allow deletion via POST request
    );
}

POST; .

, , 'postOnly + delete',

+10

javascript, jquery. jQuery , .

+1

, actionDelete() , , , AJAX . Delete()

0

All Articles