Skip Navigation

[Resolved] Can't save layout. "There was an error during the ajax request…"

This support ticket is created 4 years, 12 months 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.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 9 replies, has 2 voices.

Last updated by Christian Cox 4 years, 11 months ago.

Assisted by: Christian Cox.

Author
Posts
#1237291

I am trying to:

- Save changes to a Toolset Layout.

Link to a page where the issue can be seen:

- N/A, the problem is on the admin backend.

I expected to see:

- My changes saved.

Instead, I got:

- This error:

"There was an error during the ajax request, make sure the data you send are in json format."

#1237341

Hi, this could indicate a conflict with another plugin or theme. Can you try these troubleshooting steps first?
- Temporarily deactivate all plugins except Types, Views and Layouts, and activate a default theme like Twenty Nineteen. If you need to activate maintenance mode using a plugin that's fine.
- Make sure you're using the latest versions of Toolset plugins. Update if necessary.
- Clear your browser cache and test again. If the problem is resolved, reactivate your theme and other plugins one by one until the problem returns.
- If the problem is not resolved by deactivating all other plugins and themes, continue to the next steps.
- Open the browser console and check for any JavaScript errors that appear when you try to edit the Layout. Copy + paste those here for me to review.
- Is your site hosted on WP Engine? There is currently an issue with specific types of caching on their system.

#1237937

Hi! Thanks for this reply.

This site has a lot of plugins, so it will take some time to debug that.

In the meantime, I checked for errors when I try to save a layout, and this Javascript error comes up:

Failed to load resource: the server responded with a status of 500 ()
/wp-admin/admin-ajax.php?_fs_blog_admin=true

Does this mean the page somehow doesn't know I'm logged in as admin? I am definitely logged in as admin, since I'm accessing the layout editing page.

This might be helpful: in an effort to reduce CPU load, one of our tech people added this code to our functions.php:

remove_action( 'wp_enqueue_scripts', 'ref_enqueue_customizer_css', 100 );

remove_action( 'wp_ajax_ref_dynamic_css', 'ref_dynamic_css' );

remove_action( 'wp_ajax_nopriv_ref_dynamic_css', 'ref_dynamic_css' );

Could any of these be affecting this issue?

Our site is not hosted on WPEngine. But it is hosted on Siteground, and I think the tech people might be using as aggressive caching from Siteground. We also use Cloudflare, although I don't think would affect admin pages. Have you had any issues with Siteground or Cloudflare?

#1237941

Does this mean the page somehow doesn't know I'm logged in as admin?
No, most likely that's unrelated. An error code 500 on admin-ajax.php may refer to any generic server-side error, not necessarily something related to user role or login state.

This might be helpful: in an effort to reduce CPU load, one of our tech people added this code to our functions.php
I can't tell from the code you have included here whether or not these actions are part of the problem. Switching to a default theme temporarily might be a simple way to eliminate that as the source, if the problem remains after switching.

Have you had any issues with Siteground or Cloudflare?
I'm aware of one issue with memcached, specific to Siteground / SG Optimizer, that will be addressed in the upcoming Types 3.3 release. Here's a link to that ticket: https://toolset.com/forums/topic/memcached-prevents-field-group-title-from-saving/

I'm not aware of any open issues with Cloudflare. Most of the time CDN issues can be resolved by purging caches and excluding Toolset files from minification.

#1238364

Thanks for these notes!

I tried disabling all the plugins except Toolset on a staging site. This does allow me to edit the Toolset Layout. I'm not sure which plugin is the problem, but by disabling them all, I was able to make this change, then enable the plugins again.

Thanks!

#1238368

Okay that indicates a conflict with another plugin or combination of plugins. By reactivating them one by one, or in large groups, testing each time, you should be able to eventually pin down which plugins are the source of the conflict. Once you determine that, I can try to replicate the same issue locally by installing the same plugin. If it's replicable, our compatibility team can try to collaborate with the plugin's authors to come up with a solution. If it's not replicable, I'll have to do some more in-depth investigation, preferably on your staging site or a copy of the staging site.

#1238380

Thanks, Christian! I'm not sure the client will want me to hunt this down like that or share a staging copy, but I appreciate that you all would want to debug this.

I'm fairly certain that Beaver Builder is involved, because that was the last plugin I needed to deactivate in order for the save to work. I don't know whether using Beaver Builder and Toolset on the same site is even quite legitimate (especially now that Gutenberg is here), but they do seem to serve different use cases.

One other note in case anyone else finds this thread: after I reactivated all the plugins, the client noticed that all custom types with Toolset Types were throwing a 404 "page not found". It turned out that the URLs for custom post types weren't loading. The solution was to clear the site cache; since we're on Siteground, that meant clicking "Purge SG Cache," but it would be different on other systems.

I am hoping that future plugin updates will quietly fix this, but I may revisit this thread in the future if we need to make more extensive layout edits and we're still getting this error.

thanks!

#1238646

Beaver Builder and Layouts should not be used together, but other Toolset suite features are compatible with BB. Check our best practices documentation here: https://toolset.com/documentation/user-guides/using-toolset-with-beaver-builder/

#1240001

Thanks for the link! Hmm, that is interesting that you advise against using both Toolset Layouts and Beaver Builder.

On our site, we rely heavily on Layouts to provide a standard layout for each of several custom post types. I don't know any other tool I'd want to use for this, it's one of the main reasons I choose Toolset.

Yet we also sometimes need to create one-off pages with fancy layouts, which is exactly the use case for Beaver Builder.

For these pages, I use a simple Toolset Layout that only includes a standard site footer. But it sounds like you are saying that Beaver Builder should not be used on this site at all, since we rely on Toolset Layout.

What other page builder would you recommend instead, that is comparable with Beaver Builder in features?

Thanks!

#1240006

What other page builder would you recommend instead, that is comparable with Beaver Builder in features?
We recommend not using any other page builder system if your site uses Toolset Layouts:
https://toolset.com/documentation/user-guides/page-builders/

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.