Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder MrBiggZ's Avatar
    Join Date
    Apr 2005
    Location
    Indianapolis IN
    Posts
    258
    Thanks
    37
    Thanked 0 Times in 0 Posts

    Page not loading before script runs

    Hi!

    I'm no javascript person, only experience I have is from examples and trial and error.

    I have this page http://ftsc-v2.handlersspot.net/achievements.html that in Chrome will not load properly and I might have to refresh the page 5-10 times before it does, Firefox just on refresh does it and IE9 one to two refreshes does the same.

    For this case do I have my script tag in the right part of the page or is there some syntax that is missing?

    You can view the source here http://ftsc-v2.handlersspot.net/achievements_source.txt

    I do faintly recall a on window or on page load type syntax but I'm not sure the exact wording of it!

    I appreciate the help!

    Cheers!
    “No matter how slick the demo is in rehearsal, when you do it in front of a live audience, the probability of a flawless presentation is inversely proportional to the number of people watching, raised to the power of the amount of money involved.” ~ Mark Gibbs

  • #2
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,455
    Thanks
    0
    Thanked 632 Times in 622 Posts
    Try moving the script tags to just before the </body> tag - that's where JavaScript is supposed to go most of the time.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  • Users who have thanked felgall for this post:

    MrBiggZ (03-03-2013)

  • #3
    Senior Coder xelawho's Avatar
    Join Date
    Nov 2010
    Posts
    2,762
    Thanks
    55
    Thanked 517 Times in 514 Posts
    Quote Originally Posted by MrBiggZ View Post
    I do faintly recall a on window or on page load type syntax but I'm not sure the exact wording of it!
    you already have that, here:
    Code:
    $(document).ready(
    your page seems to load OK for me in Chrome. Can you explain what is supposed to be happening that isn't?

  • Users who have thanked xelawho for this post:

    MrBiggZ (03-03-2013)

  • #4
    Regular Coder MrBiggZ's Avatar
    Join Date
    Apr 2005
    Location
    Indianapolis IN
    Posts
    258
    Thanks
    37
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by felgall View Post
    Try moving the script tags to just before the </body> tag - that's where JavaScript is supposed to go most of the time.
    Move it ..

    Quote Originally Posted by xelawho View Post
    you already have that, here:
    Code:
    $(document).ready(
    your page seems to load OK for me in Chrome. Can you explain what is supposed to be happening that isn't?
    And since I moved it, it's functioning find now! I think the script was executing before the server could server the dynamic code from the php.

    That little move did the trick! =)

    Thanks!
    “No matter how slick the demo is in rehearsal, when you do it in front of a live audience, the probability of a flawless presentation is inversely proportional to the number of people watching, raised to the power of the amount of money involved.” ~ Mark Gibbs


  •  

    Posting Permissions

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