Answer the question
In order to leave comments, you need to log in
How pjax works?
Explain who is well versed in the issue.
In general, Pjax makes a request and receives the entire page in response, and then cuts out the block from it that needs to be noticed and replaces the old block with it, right?
It's not optimal at all. Versatile, but looks like a crutch, not a tool.
Answer the question
In order to leave comments, you need to log in
Pjax will receive what you pass. Pass a full page - it will take only a piece, pass only a piece - it will be more optimal. Pjax is a js script, it is not connected to the server and has no idea what is going on there. It waits for a response from which it is necessary to take a container with a certain selector.
Accordingly, in the action, you can separate the logic into pjax or regular get and return this or that.
At first, a lot of things confused me in it too, I did not understand its degree of integration into yii. The docks that are torn off from yii helped, specifically on the Pjax js plugin:
https://github.com/yiisoft/jquery-pjax
It came to an understanding that yii2 has a widget to work with it and nothing more, plus a verification method that I cited above. And in fact, deeper integration is not necessary.
In general, Pjax makes a request and in response receives the entire page, and then cuts out of it the block to be replaced with and replaces the old block with it, right?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question