Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
  1. #1
    New to the CF scene
    Join Date
    Jun 2012
    Thanked 0 Times in 0 Posts

    JSON/Social Media Buttons Lagging up Site


    I am making custom social media buttons for a company website, and everything works perfectly fine in the testing stage (pulling page count numbers, having the social buttons scroll with the user and respond with responsive design), but when the code is pushed live, it stops all javascript on the page. Once, it even crashed the site for a few hours.

    I'm not sure where the problem might be. I've tried removing bits of my javascript code sections at a time, and narrowed down the cause to this:

    /* =============================== Grabbing URL */
            url = $(location).attr('href');
            beforecounter = "     ";
            aftercounter = "";
           /* =============================== Grabbing Facebook Count */
            $.getJSON('http://graph.facebook.com/' + url + '&callback=?', 
                $('#vert_fbcount').append(beforecounter + data.shares + aftercounter);
                $('#horz_fbnum').append(beforecounter + beforecounter + data.shares + aftercounter);
          /* =============================== Grabbing Twitter Count */
              function(data) {
                   $('#vert_twitcount').append(beforecounter + data.story.url_count + aftercounter);
                   $('#horz_twitnum').append(beforecounter + beforecounter + data.story.url_count + aftercounter);
    I am not sure if the .getJSON is the problem? It's just surprising since I was able to grab the Facebook and Twitter counts when testing, but when live, all javascript doesn't work and the whole site gets laggy.

    Any idea/suggestions on what the problem could be?

    Thank you so much!

    - Jeff
    Last edited by jzhan10; 06-27-2012 at 07:25 PM.


Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts