The api's wont load

43 views
Skip to first unread message

mystrymaster

unread,
Jun 2, 2010, 3:15:44 PM6/2/10
to Google AJAX APIs
I have copy and pasted the code from the examples into a local web
page and I have gotten nothing in return.

I am trying to verifiy that they have been loaded by simply calling an
alery from within the jquery $(document).ready

Nothing.

Any help?

Here is the base code I am using

<script type="text/javascript" src="http://www.google.com/jsapi?key=MY-
Key-Removed"></script>
<script type="text/javascript">
google.load("jquery", "1");
google.load("webfont", "1");
google.setOnLoadCallback(function() { WebFont.load({ google:
{ families: [ 'Droid Sans' ] } });
$(document).ready(function() {
alert('Here');

});
</script>

Jeremy Geerdes

unread,
Jun 3, 2010, 11:44:56 AM6/3/10
to google-ajax...@googlegroups.com
The problem that you're having here is that google.setOnLoadCallback and $(document).ready are essentially synonymous. The onload event only fires once, and that's what both of these are listening for.

Jeremy R. Geerdes
Effective website design & development
Des Moines, IA

For more information or a project quote:
http://jgeerdes.home.mchsi.com
jrge...@gmail.com

If you're in the Des Moines, IA, area, check out Debra Heights Wesleyan Church!

> --
> You received this message because you are subscribed to the Google Groups "Google AJAX APIs" group.
> To post to this group, send email to google-ajax...@googlegroups.com.
> To unsubscribe from this group, send email to google-ajax-searc...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/google-ajax-search-api?hl=en.
>

mystrymaster

unread,
Jun 3, 2010, 1:19:26 PM6/3/10
to Google AJAX APIs
Then why wont the font load?

I have removed the document ready (I found a couple sources on line
that said to place the document ready in the setOnLoadCallBack because
of slow loading with google.load

I have removed that and yet still the font wont load.

On Jun 3, 11:44 am, Jeremy Geerdes <jrgeer...@gmail.com> wrote:
> The problem that you're having here is that google.setOnLoadCallback and $(document).ready are essentially synonymous. The onload event only fires once, and that's what both of these are listening for.
>
> Jeremy R. Geerdes
> Effective website design & development
> Des Moines, IA
>
> For more information or a project quote:http://jgeerdes.home.mchsi.com
> jrgeer...@gmail.com

Jeremy Geerdes

unread,
Jun 3, 2010, 1:34:39 PM6/3/10
to google-ajax...@googlegroups.com
Try something like this:

http://savedbythegoog.appspot.com/?id=0124ca289e52815e6bbfa4987e67cb78cffd0f0f

You can also replace the google.setOnLoadCallback with the $(document).ready version:

http://savedbythegoog.appspot.com/?id=cb8bf22f4539efee3147319eb5e175eae9e5b72a

Jeremy R. Geerdes
Effective website design & development
Des Moines, IA

For more information or a project quote:
http://jgeerdes.home.mchsi.com

jrge...@gmail.com

If you're in the Des Moines, IA, area, check out Debra Heights Wesleyan Church!

mystrymaster

unread,
Jun 4, 2010, 10:34:36 AM6/4/10
to Google AJAX APIs
Yeah that's what I ended up doing, breaking the google.load into there
own javascript tag then the document.ready in a separate script tag.

Thanks for the help I appreciate it

On Jun 3, 1:34 pm, Jeremy Geerdes <jrgeer...@gmail.com> wrote:
> Try something like this:
>
> http://savedbythegoog.appspot.com/?id=0124ca289e52815e6bbfa4987e67cb7...
>
> You can also replace the google.setOnLoadCallback with the $(document).ready version:
>
> http://savedbythegoog.appspot.com/?id=cb8bf22f4539efee3147319eb5e175e...
Reply all
Reply to author
Forward
0 new messages