Skip Navigation

[Resolved] Ajax calls on load causing backlog

This support ticket is created 4 years, 1 month ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

This topic contains 1 reply, has 1 voice.

Last updated by jeanB 4 years, 1 month ago.

Author
Posts
#1783311
Screenshot 2020-09-20 at 20.30.08.png
Screenshot 2020-09-20 at 20.23.41.png

Hi there,

I have a page that lists around 60 posts of a custom post type.

Some of those posts have a CRED form included - in this example, there are around 30 forms, each form only has 1 or 2 fields.

When the page loads, it sends off 169 AJAX requests.

This then causes anything I have to have to wait for them to finish. So, when my page loads, I want the user to be able to perform an AJAX action when they need to. At the moment, it takes over 1 minute to finish doing the calls.

What's going on and how can I improve this, please? It's making my site pretty unusable at the moment.

I'm happy for the CRED form to load on a button click, but I can't see how I can do that either.

I've also tried having pagination, so it doesn't load all at once, but that then seems to break any additional JS I have included in my theme. It's not feasible for me to include the JS in the view - my site is very complicated, so I need to keep things in their appropriate places in the theme.

Thanks in advance.

#1784283

Not to worry! Thanks guys - my fault entirely.

I've re-looked at my conditional logic and I had included some forms where they needn't be, so I was pointlessly loading them. Doh.