Skip to content Skip to sidebar Skip to footer

Javascript Does Not Load In Initial Page Load

Im having issues with having to load my javascript, when I visit my website (php) for the first time(cookies cleared) and I click on a link (which calls a javascript method), it do

Solution 1:

Fire up firebug and see if you're actually getting Javascript sent down the wire. Is there a 404 or 500 whooshing by? Or is code loading correctly? Is your event handler being called? Add a console.log or alert to your handler to test. Is your handler even being attached? Did you put the whole thing in a $(document).ready()? Did you put your script after the jquery.js file, so that jQuery is available when your script attaches event handlers? In general, you know, do that debugging thing we all love so much.

Solution 2:

If your problem is occurring in IE8, you should:

  1. try to use the normal version o jQuery (instead of the minified one)
  2. in IE's advanced options, make sure that disable script debugging isn't checked
  3. fire up IE's developer tools (shortcut for that should be F12) and start script debugging
  4. using the script debugger, try to understand the stack where IE is firing up the error, namely what's jQuery trying to do when the error is triggered

Once you have the thing that jQuery is trying to do when the error is triggered, you should be able to either workaround the issue or find that the bug is jQuery's and submit it to the project maintainers.

Post a Comment for "Javascript Does Not Load In Initial Page Load"