Rediska's avatar

Is it possible to start rendering page content while data is being fetched in the background?

I probably misunderstood the question, so I'll try to explain in more detail. I need to get two things:

  1. products from the catalog
  2. available product attributes

It is elementary to get products from the catalog and if you use pagination, then very quickly. In order to get all the possible attributes of the products, more time is needed.

The question is the following - can I pass product data to the "view" with the received products, and load the available attributes in the background. And until I get this data, then display "loading" in the sidebar.

I read on some forum that it is possible to call a function from "view" that will access the database and only then receive data by attributes. It seems to me that this approach is absolutely wrong and violates common sense. What do you advise?

0 likes
3 replies
Sinnbeck's avatar

This is what you call ajax. It's a request done with Javascript which loads the data and puts it on the page

Rediska's avatar

@Sinnbeck This I know. I just want to clarify - maybe Laravel provides such a command. Turns out it's not =)

Please or to participate in this conversation.