Jump to content

How run a hook asynchronously ?


Recommended Posts

I currently have a display hook for module that makes a HTTP request on every load. Since the request is done at the backend by the module (since it uses credentials from the admin), the pages are sometimes slow to load.

Is there a way to asynchronously load a display hook to ensure the rest of the page load regardless of my display module?

Link to comment
Share on other sites

I'm making a few assumptions about what you're trying to achieve here, but this is what comes to mind.

Have the display hook load the template in an empty/loading state (showing a 'loading' animation or whatever), then perform the http request via ajax, and populate the template with the returned data.

Sorry if I've misunderstood and that's not suitable, just emptying my head 😄

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...