Javascript nodejs asynchronous calls need to be collected

I am using tumblr module of nodejs to access tumblr. Funny as it may seem I am new to javascript and nodejs. I need help with the following concept. Lets say I make these two calls:

var someCrapArrayWhichINeedFilled = new Array();
tumblr.get('/posts/photo', {hostname: 'scipsy.tumblr.com', limit:3}, function(json){
                console.log(json);
                someCrapArrayWhichINeedFilled.push(json);
            });
tumblr.get('/posts/photo', {hostname: 'vulpix-bl.tumblr.com', limit:3}, function(json){
                console.log(json);
                someCrapArrayWhichINeedFilled.push(json);
            });

Now I know that the callbacks are callbacks and they will fire when they fire. So the question is how do they actually fire. when do they actually fire. How can i populate an array so that I can use it.

Again I need to take three pictures from two different blogs and should return then on my web page. My server and client side is all in javascript. Therefore tell me the proper thought of how its done in javascript world and what libraries can be used for this purpose.

This is what I personally use for a request that queries a variable number of 'types' (which result in separate queries). I count the number of types requested, collect the query responses and trigger the callback as soon as they are all collected:

/**
 * @param payLoad -  Object, expected to contain:
 *   @subparam type - Array, required.
 *   @subparam location - Array, contains [lat,lng], optional
 *   @subparam range - Int, optional
 *   @subparam start - String, optional
 * @param cbFn - Function, callBack to call when ready collecting results.
 */
socket.on('map', function (payLoad, cbFn) {
    if (typeof cbFn === 'undefined') cbFn = function (response) {};
    var counter = 0,
        totalTypes = 0,
        resultSet = [];
    if (typeof payLoad.type === 'undefined' || !(payLoad.type instanceof Array)) {
        cbFn({error : "Required parameter 'command' was not set or was not an array"});
        return;
    }
    totalTypes = payLoad.type.length;

    /**
     * MySQL returns the results in asynchronous callbacks, so in order to pass
     * the results back to the client in one callBack we have to
     * collect the results first and combine them, which is what this function does.
     *
     * @param data - Object with results to pass to the client.
     */
    function processResults (data) {
        counter++;
        //Store the result untill we have all responses.
        resultSet.push(data);
        if (counter >= totalTypes) {
            //We've collected all results. Pass them back to the client.
            if (resultSet.length > 0) {
                cbFn(resultSet);
            } else {
                cbFn({error : 'Your query did not yield any results. This should not happn.'});
            }
        }
    }

    //Process each type from the request.
    payLoad.type.forEach(function (type) {
        switch (type.toLowerCase()) {
            case "type-a":
                mysqlClient.query("SELECT super important stuff;",
                    function selectCallBack (err, results) {
                        if (!err && results.length > 0) {
                            processResults({type : 'type-a', error : false, data : results});
                        } else {
                            processResults({type : 'type-a', error : "No results found"});
                        }
                    });
                break;
            case "type-b":
                mysqlClient.query('SELECT other stuff',
                    function selectCallBack (err, results) {
                        if (!err && results.length > 0) {
                            processResults({type : 'type-b', error : false, data : results});
                        } else {
                            processResults({type : 'type-b', error : "No results found"});
                        }
                    });
                break;
            default:
                processResults({type : type, error : 'Unrecognized type parameter'});
                break;
        }
    });
});

Rewrite your code using the async module as follows:

var async = require('async');

async.parallel([
    function (callback) {
        tumblr.get('/posts/photo', {hostname: 'scipsy.tumblr.com', limit:3}, function(json){
        console.log(json);
        callback(false, json);
    },
    function (callback) {
        tumblr.get('/posts/photo', {hostname: 'vulpix-bl.tumblr.com', limit:3}, function(json){
        console.log(json);
        callback(false, json);
    }
], function (err, someCrapArrayWhichIsAlreadyFilled) {
    //do work
});