Alexey2020-03-24 16:06:56
Alexey, 2020-03-24 16:06:56

How to catch PJAX errors in Yii2?

Good day colleagues.

I have been struggling with PJAX in YII2 for several days, but everything is even.

1) There is a table with data.
2) I create a model of this table using GII.
3) I create CRUD + PJAX using GII

In theory, everything should work out of the box in this situation, but for some reason it does not work. Those. a GridView appears with data and pagination, when you click on the pagination in the debugger from YII, you can see that the request is happening, but it ends with an error that cannot be observed in the debugger. Next, the page is reloaded. PJAX did not receive a response from the server.

Here is some data from debugger
General Info
Name Value
method 'GET'
isAjax true
isPjax true
isFlash false
isSecureConnection false

Name Value
Route 'admin/calendar/index'
Action 'app\\modules\\admin\\controllers\\CalendarController::actionIndex()'
Parameters []

Name Value
page '4'
_pjax '#pjax_gridview'

Response Headers
Name Value
Expires 'Thu, 19 Nov 1981 08:52:00 GMT'
Cache-Control 'no-store, no-cache, must-revalidate'
Pragma 'no-cache'
X-Pjax-Url '/admin/calendar /index?page=4&_pjax=%23pjax_gridview'
Content-Type 'text/html; charset=UTF-8'
X-Debug-Tag '5e79fbb4a838c'
X-Debug-Duration '1,529'
X-Debug-Link '
Set-Cookie '_identity = d4f2d6369ba74e45ae5fe16878a32711a733990ef873df48eefd2e7575c9e0ffa% 3A2% 3A% 7Bi% 3A0% 3Bs% 3A9% 3A% 22_identity% 22% 3Bi% 3A1% 3Bs% 3A16 % 3A% 22% 5B1% 2Cnull% 2C2592000% 5D % 22% 3B% 7D; expires=Thu, 23-Apr-2020 12:23:15 GMT; Max Age=2591999; path=/; HttpOnly'

Prompt. what else can be done. to make PJAX work?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Alexey Guest007, 2019-08-31

Need more information.
For example, put the simplest counter. To display the number of requests to the dump. you can calculate the time even more accurately. Before the loop, save the current time and in each print('Request sent') in addition to the current counter, also display the time delta. So you can always see exactly how many requests passed and how long the process stopped exactly.
Before nailing - look at how much memory the process took. Maybe an overflow?
What is the session lifetime? Maybe the session just expires - you're hammering within the session, and not with separate requests.
Basically just analytics. Analysis is a significant working part of a programmer's time :-)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question