yii2 - check if request is ajax request

yii2
voted: 1
vote
yii2 php ajax request

Check if request is ajax request.

public function actionDelete() {
        if (Yii::$app->request->isAjax) {
            // request is ajax request
        }
        else {
            // not ajax request
            // for example redirect
        }
}
working url: not entered
version: 2
Leave a Comment:
Characters left:
No comments yet.