Vazark Posted July 8, 2022 Share Posted July 8, 2022 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 More sharing options...
Tom Girou Posted July 8, 2022 Share Posted July 8, 2022 Is a curl request or similar the cause of the issue ? AFAIK there's no native async in PHP. But some libs exist. Maybe you could try to install one and use it inside your module. Link to comment Share on other sites More sharing options...
lordignus Posted July 8, 2022 Share Posted July 8, 2022 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 More sharing options...
Ress Posted July 9, 2022 Share Posted July 9, 2022 Can't you do an ajax request after loading the page? Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now