Note that there are some explanatory texts on larger screens.

plurals
  1. POgoogle.load not working when run in jquery's $(window).load(function(){});?
    text
    copied!<p>I'm using the Google AJAX Feed API to search for a RSS feed. It works when I just run the javascript in the head of my HTML document in EXAMPLE 1 below (I know I'm getting no result, but that's a problem for another day!), but I need to actually run it when everything's loaded. I'm using jquery, so I've got a $(window).load(function(){}); method, but it doesn't work when I run the Google code in there (EXAMPLE 2). Can anyone see what I'm doing wrong?</p> <p>EXAMPLE 1 - index.html</p> <pre><code>&lt;head&gt; &lt;script type="text/javascript"&gt; console.debug("before google load code"); google.load("feeds", "1"); console.debug("after google load code"); google.setOnLoadCallback(loaded); function loaded() { console.debug("google loaded"); google.feeds.findFeeds("news", feedSearchDone); } function feedSearchDone(result) { if (result.error || result.entries.length &lt;= 0) { console.debug("No Results Found"); return; } else { console.debug(result.entries[0].url); } } &lt;/script&gt; &lt;/head&gt; </code></pre> <p>EXAMPLE 1 - code.js</p> <pre><code>$(window).load(function() { console.debug("in jquery load function"); }); </code></pre> <p>EXAMPLE 1 - output in Firebug:</p> <pre><code>before google load code after google load code in jquery load function google loaded No Results Found </code></pre> <p>EXAMPLE 2 - code.js</p> <pre><code>$(window).load(function() { console.debug("in jquery load function"); console.debug("before google load code"); google.load("feeds", "1"); console.debug("after google load code"); google.setOnLoadCallback(loaded); function loaded() { console.debug("google loaded"); google.feeds.findFeeds("news", feedSearchDone); } function feedSearchDone(result) { if (result.error || result.entries.length &lt;= 0) { console.debug("No Results Found"); return; } else { console.debug(result.entries[0].url); } } }); </code></pre> <p>EXAMPLE 2 - output in Firebug</p> <pre><code>in jquery load function before google load code window.loadFirebugConsole is not a function [Break on this error] &lt;html lang="en"&gt; </code></pre> <p>Even though the error refers to Firebug, I don't think that's the cause because it the page behaves the same (no elements are on the screen) when I view it in Safari. Thanks for reading.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload