S
S
Stanislav Shabalin2020-04-23 12:52:12
PHP
Stanislav Shabalin, 2020-04-23 12:52:12

Is it correct to use browser session variables to pass an array to the ajax handler?

Gentlemen, to pass the array to the ajax handler on the server side, I used the session variable to load content on the page, bypassing javascript variables. It turns out that in the PHP template I make a request to the database and save the resulting array with content to the session. Then only the handler function works when the js-script condition is triggered when the screen is scrolling, which shortens the array after displaying its next part$_SESSION['cat_array']

I did this so that when loading content, I don’t make requests to the database every time, but do it once at the beginning and display the content in portions, deleting it from the array and resaving it in the session variable. In general, I did not want to use javascript variables to store a serialized array. Tell me, is this a good practice and will there be any problems with any browsers when using session variables?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question