JSON error

Hello.

Our primary issue is that the slider element is no longer displaying on the page.

At the same time this occurred, we began receiving an error on page load. This doesn’t happen in PRO, only in Child Theme, but If we remove all customizations from child theme, issue still remains. Wondering if it’a a customizer issue.

error in console:
Uncaught SyntaxError: Unexpected end of JSON input
at JSON.parse ()
at cs-body.js:2
at NodeList.forEach ()
at cs-body.js:1
at Array.forEach ()
at o (cs-body.js:1)
at Array.forEach ()
at HTMLDocument. (cs-body.js:1)

If we remove var n=JSON.parse(t.getAttribute("data-x-params")); from /wp-content/themes/pro/cornerstone/assets/dist/js/site/cs-body.js the error is gone. That line is in the middle of this section:

27:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=function(t,e){(0,o.default)('[data-x-element="'+t+'"]',function(t){var n=JSON.parse(t.getAttribute("data-x-params"));return e.call(t,n||{})})};var i=t("../lib/everinit"),o=function(t){return t&&t.__esModule?t:{default:t}}(i);e.exports=n.default},{"../lib/everinit":24}],

What is causing the slider to go missing and is this area of code helpful in isolating the issue?

Thanks

Hi There,

Please try testing for a plugin conflict. You can do this by deactivating all third party plugins, and seeing if the problem remains. If it’s fixed, you’ll know a plugin caused the problem, and you can narrow down which one by reactivating them one at a time.

Let us know how it goes!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.

Hi @redpupmedia,

The source of this issue is the content of your footer, the one with the newsletter. The issue disappears when you disable the child theme, is because the widget is disabled along with it.

Please try removing that widget :slight_smile:

Thanks.

Thanks @iam, we had an unclosed { in the widget.
data-x-params="{">

Thanks for directing us to that area! Issue resolved.

Glad to hear you got it sorted.

Cheers!

Hello,

We have exactly the same JSON error in console, when we add a flexslider (which is not showing on page).
No unclosed { in data-x-params…
Any suggestions ?

Hi There @3iS

If you’re using a caching plugin, you need to purge your server cache and also clear your browser cache before testing your site again.

If you’re still having issues, provide us with an example page URL of your site to check your issue further.

Thanks!

It’s not a cache problem.
The slider included in a Tab system was working the previous year, but not this one. Probably due to an update.

For exemple no slider appears in the “Dates” tab, on this page : https://www.3is.fr/paris/concours-lyceen-2018-etranger-etrangere/#dates

The slider is not showing too, when duplicated outside a tabs system.

Hi @3iS,

In that case, would you mind disabling your cache plugins first then we’ll check? The CSS is coming from minified styling of Autoptimize plugin and we can see it through the site’s source code. I’m not saying it’s the cause, but we like to check it without any cache to properly trace the issue.

Thanks!

So let’s try to create a slider on another website without Autoptimize plugin installed :
https://www.3is.fr/bordeaux/test/

Hi @3iS,

Thanks, I still can’t find what’s causing the JSON error. Would you mind starting a new thread about this and provide the login credentials of your test site in the secure note?

Please allow me to disable the plugins too.

Thanks!

It’s done there : https://theme.co/apex/forum/t/x-flexslider-not-displayed-with-a-json-error-in-the-console/44932

Thx

Thanks for creating a new thread.