google.load function doesn't work if called from jquery ready function?
I'm using the Google AJAX APIs, but some reason google.load works when run through normal javascript, but if I call the method from my jquery ready function it doesn't work. Code and output is below, any help would be greatly appreciated!
page.html
- <script type="text/javascript">
- loadGoogleStuff();
- function loaded() {
- console.debug("in loaded function");
- }
- function loadGoogleStuff() {
- console.debug("before google load code");
- google.load("feeds", "1");
- console.debug("after google load code");
- google.setOnLoadCallback(loaded);
- }
- </script>
- <%= javascript_include_tag "code.js" %>
code.js
- $(window).ready(function() {
- console.debug("in jquery load function");
- });
Output:
- before google load code
- after google load code
- in jquery load function
- in loaded function
But this doesn't work
page.html
- <script type="text/javascript">
- function loaded() {
- console.debug("in loaded function");
- }
- function loadGoogleStuff() {
- console.debug("before google load code");
- google.load("feeds", "1");
- console.debug("after google load code");
- google.setOnLoadCallback(loaded);
- }
- </script>
- <%= javascript_include_tag "code.js" %>
code.js
- $(window).ready(function() {
- console.debug("in jquery load function");
- loadGoogleStuff();
- });
Output:
- window.loadFirebugConsole is not a function
If I comment out line 3 in code.js, the console debug runs okay, so the ready function is running okay. Even though there's a reference to Firebug, the same error occurs in Safari too. Nothing on the page loads. Does anyone know why this is occurring? Thanks for reading.