Put your lines of code in separate <script> tags.

google.load() uses document.write() to write a <script> tag into the
document. This <script> tag is not executed until the current <script> tag
exits. So your jQuery.noConflict() call is being executed before jQuery is
loaded.

If you break up the <script> tags like this, it should work fine:

<script type="text/javascript>
google.load("jquery", "1");
</script>

<script type="text/javascript>
jQuery.noConflict();
google.load("prototype", "1");
</script>

-Mike

On Wed, Dec 16, 2009 at 7:58 AM, speedpac...@gmail.com <
speedpac...@gmail.com> wrote:

> Hi,
>
> For obvious reasons, we try using Google to load javascript libraries
> when we need them.
> We already used Prototype using google.load() function, and now we
> decided to add jQuery as well since we will be using some jQuery UI
> widgets to speed up development on a project (more specifically we
> need a decent date selector!
>
> Basically, what we did is:
>
> google.load("jquery", "1");
> jQuery.noConflict();
> google.load("prototype", "1");
>
> Unfortunately, for some reason, it complains that noConflict() is no
> method leading me to believe tha the jQuery code isn't loaded properly
> prior to calling the noConflict() method...
>
> We have never had such an issue in the past, and if we link directly
> to the .js file hosted on google servers without using the google.load
> () method, it works fine as well...
>
> Does anyone know this is a known issue when working with google.load
> ()?
>
> Since we manage the needed libraries through a database, and use the
> google.load() function for all these libraries, it would be a shame if
> we need to include jQuery library directly without using the
> google.load() method :)
>
> thanks in advance for your very much appreciated feedback!
>
> David.
>

Reply via email to