Yii - Yii :: app () & # 8594; request-> isAjaxRequest?

I am a little confused about isAjaxRequest. Why and when should I use this? Is this important when the data submitted by the jQuery AJAX submit form?

+4
source share
1 answer

You can use this method to check if the controller has been called using an AJAX request or not. This may allow you to do some adaptive rendering. For example, if it is not an AJAX request that returns HTML, if it is an AJAX request, return JSON.

+5
source

Source: https://habr.com/ru/post/1534014/


All Articles