Jump to content
*Coming November/December* Signature Rigs & Content Embed Wizard (Google Docs,Soundcloud,Spotify & More) ×
*Coming December* EHW Marketplace ×

Welcome to ExtremeHW

Welcome to ExtremeHW, like most online communities you must register to view or post in our community, but don't worry this is a simple free process that requires minimal information for you to signup. Be a part of ExtremeHW by signing in or creating an account.

  • Start new topics and reply to others
  • Subscribe to topics and forums to get email updates
  • Get your own profile page and make new friends
  • Send personal messages to other members.
  • Take advantage of site exclusive features.

Issue with slider area on home page?


Recommended Posts

You may already be aware of the slider not working on the home page E, but if not, here's some additional info for you and your site devs (ref. the screen cap at the bottom of this post for a screen shot):

 

The following error is showing up in the dev consoles in both Chrome and Mozilla (Firefox): SyntaxError: Unexpected token o in JSON at position 1

 

The full text of the issue follows:

 

(index):1 Uncaught SyntaxError: Unexpected token o in JSON at position 1
    at JSON.parse (<anonymous>)
    at Object.success ((index):329)
    at i (jquery.js?ver=1.12.4-wp:2)
    at Object.fireWith [as resolveWith] (jquery.js?ver=1.12.4-wp:2)
    at x (jquery.js?ver=1.12.4-wp:4)
    at XMLHttpRequest.c (jquery.js?ver=1.12.4-wp:4)


The script that's generating the error follows (it starts at line 324 of index.php for the home page):

 

    <script>
        var $ = jQuery;
        $(document).ready(function () {

            $.get('https://extremehw.net/fetchPosts.php', function(data) {
                let posts = JSON.parse(data);

                $.each(posts, function(index, post) {
                    let trueIndex = index + 1;
                    let titleWrapper = $('#post-' + trueIndex + '-title');
                    let authorWrapper = $('#post-' + trueIndex + '-author');
                    let dateWrapper = $('#post-' + trueIndex + '-date');
                    let catsWrapper = $('#post-' + trueIndex + '-cats');
                    let bgWrapper = $('#sliderBlock-' + trueIndex);

                    titleWrapper.html(post.post_title);
                    titleWrapper.attr('href', post.post_url);
                    authorWrapper.html(post.author_name);
                    authorWrapper.attr('href', post.author_url);
                    dateWrapper.html(post.post_date);
                    catsWrapper.html(post.categories);
                    bgWrapper.attr('data-href', post.post_url);

                    bgWrapper.attr('style', 'background-image: linear-gradient(to top, rgba(0,0,0,.5),rgba(0,0,255,0)), url(' + post.thumb_url +'); background-size:cover;background-position: center center;');
                });

                 $('body').on('click', '.slider-block', function(){
                         window.location.href = $(this).attr('data-href');
                 });

                $('#sliderProgress').css('opacity', 0);
                setTimeout(function(){  $('#sliderProgress').hide();  }, 2000);
            });

        });
    </script>

 

See Fix: Unexpected token o in JSON for an explanation of what's going on and how to address the error. It's a fairly common one and there's plenty of info out there that offers help in fixing it.

 

2020-10-06_4-23-52.thumb.jpg.24db6a97e02d3f3a0577dd4cecc19085.jpg

Edited by iamjanco
added additional link to Google SERP about the issue
Link to post

Hey Bud 

 

Thanks for this. Yes I knew this was in an issue as of yesterday. We believe it was due to a plugin that was minifying JS that has caused that issue. Plugin since disabled, just waiting on devs to go in and fix :)

 

Thanks,

E

Link to post

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...

Important Information

This Website may place and access certain Cookies on your computer. ExtremeHW uses Cookies to improve your experience of using the Website and to improve our range of products and services. ExtremeHW has carefully chosen these Cookies and has taken steps to ensure that your privacy is protected and respected at all times. All Cookies used by this Website are used in accordance with current UK and EU Cookie Law. For more information please see our Privacy Policy