Foxy Forum Status

We're no longer responding to questions via our forum, but we will keep it up for historical reasons. If you can't find the answer you're looking for, please visit our knowledge base or contact us. If there's enough interest in the future, we may bring the forum back.

Javascript error on checkout page when I use jQuery

fortuityfortuity Member
in Bugs & Feature Requests edited January 2010
I'm seeing a Javascript error when the visitor clicks through from my site to the checkout page. I'm using jQuery on my site to create Javascript tabs. Clicking through from pages where I include the code
<script src="https://secure.timetoquitdrinking.com/files/foxycart_includes.js"; type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" src="scripts/jquery.js"></script>

generates the error:
Error: document.body is null
Source File: https://secure.timetoquitdrinking.com/v/0.6.0/jquery-1.3.2.min.js
Line: 19

You can see it by opening the Javascript error console in your browser and visiting http://timetoquitdrinking.com/foxycart_test.html
and then going to the checkout page by clicking any "order now" link.

There doesn't seem to be any functional problems caused by the error but I'm concerned. Should I just ignore it? Is there a way I can use jQuery on my site and not have a problem like this?
Comments
  • lukeluke FoxyCart Team
    I've seen this a few times as well on my local testing but Brett has not. We'll take a look and let you know. Just so you know, we also use jQuery so you don't need to include it in your site if you're including foxycart_includes.js first. You also don't need to include it in the checkout or cart templates.
  • Plus it looks like the jquery you're including is different than the jquery foxycart uses - perhaps that might be causing some sort of problem?

    What happens if you move the script to the bottom of the page instead of in the head?
  • brettbrett FoxyCart Team
    I actually have seen this error occasionally, but it doesn't ever seem to happen consistently for me. I also see Firebug throw errors relating to Rhapsody (streaming music) when I have that running, even though it's going on entirely separate tabs, so I'm not 100% convinced it's a "real" issue.

    But like Luke and @gougeaway said, jQuery's included by default on the checkout so you don't need to (and shouldn't) include your foxycart_includes on your checkout. We'll attempt to automatically strip it out, but you don't want it there anyway.
  • @brett, just to clarify, I'm not adding any jQuery to the checkout page. But adding jQuery to my landing page causes a Javacript error on the checkout page.

    @gougeaway and @luke, I will try shuffling around the order of my javascript includes and try using the jQuery version that FoxyCart uses. Not a high priority for me, since nothing is broken, but seeing the error unsettles me.
  • brettbrett FoxyCart Team
    @fortuity: Ah, sorry, I misunderstood. I'm not seeing that js error though currently, but it'd be very (very) odd to me if adding jQuery to the referring page is the cause of the error on the checkout. Since it only appears sporadically for me anyway it seems unlikely, but then again, stranger things have happened.
Sign In or Register to comment.