Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3624290
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T23:29:21+00:00 2026-05-18T23:29:21+00:00

I am loading Google API using google.load() and I need to process some of

  • 0

I am loading Google API using google.load() and I need to process some of what is built by it, but I need to run the JavaScript after it has already completely loaded, is there a way to ensure that happens?

Here is how I build the list of images, I need to add an attribute to each img tag though, can’t do that until after it is built right?

google.load("feeds", "1");

function initialize() {
    var feed = new google.feeds.Feed("myfeed.rss");

    feed.load(function(result) {
        if (!result.error) {             

            var container = document.getElementById("feed");

            for (var i = 0; i < result.feed.entries.length; i++) {               

               var entry = result.feed.entries[i];

               var entryTitle = entry.title;
               var entryContent = entry.content;

               imgContent = entryContent + "<p>"+entryTitle+"</p>";

               var div = document.createElement("div");
               div.className = "image";               

               div.innerHTML = imgContent;

               container.appendChild(div);
           }
       }
   });
}

google.setOnLoadCallback(initialize);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T23:29:22+00:00Added an answer on May 18, 2026 at 11:29 pm

    A simple way to do this is by creating an anonymous function in the setOnLoadCallbacklike so:

    google.setOnLoadCallback(function(){
    
        //Run the Initialize Function
        initialize(function(){
             //Run anything else here like
             alert("My function can run here :)")  
        });
    });
    

    and then just modify your initialize function.

    function initialize() { > function initialize(callback) { so that you no are passing in an anonymous function to the intialize.

    and then within the feed.load(function(result) {}); you can just do callback() to activate your callback.


    you say that anonymous function confuses you, Let me first show you a few ways to write a function

    • function hello(){}
    • hello = function(){}

    The above are non-anonymous functions

    Anonymous functions are functions that are not assigned to a variable, so the parser goes over the function and does not execute it

    alert("Start")
    function()
    {
        alert("Middle")
    }
    alert("End");
    

    Running the above will show Start and End in a dialog but Middle will never show as the function has not been executed.

    Function the following:

    ( F )( P )
    

    Where F is an anonymous function and P Is the param that should be in the scope, you can directly run anonymous functions without ever assigning to the function to a variable liek so:

    alert("Start")
    (
        function(Doc){
            alert("Middle");
        }
    )(document)
    alert("End")
    

    So document gets passed into the anonymous function and becomes Doc in that scope, and Start, Middle and End all will get executed as your using a self executed anonymous function

    Ok so I might have gone over the top with the explanation so ill just quickly show you how the original method works

    http://en.wikipedia.org/wiki/Ajax_(programming)

    Ajax is Asynchronously which means that when your calling a server such as google for some information, your javascript will continue to execute which means while your waiting for data your javscript has carried on executing..

    This is why we devoted callbacks just like the initialize callback, which the google Javascript library executes when its got the data, when have create our own and were executing when we want to.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm loading reCAPTCHA via JavaScript http://www.google.com/recaptcha/api/js/recaptcha_ajax.js and am using jquery-1.5.2.min.js to communicate with a
I built a web app where I'm using the Google API. Yesterday it worked
Some time ago I used the regular method of loading Google Maps API like
I am making a userscript for facebook that would help translate text using Google
I have a little button on my page that should load a google map.
I am using this pseudocode to retrieve some json files and put their content
Our website uses the Google API to execute google searches. The problem I am
Is there a way to have a loading icon while the map is loading
I am trying to display an .svg file in a HTML page using jQuery
i have made an android application and in it , there is one scenario

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.