Possible Duplicate:
How to return value from $.getJSON
        function get_url(){
            var returnValue  = null;
            $.getJSON('http://127.0.0.1:1337/?callback=?&command=get_url', "", function(data){
                data = $.parseJSON(data);
                returnValue = data[0].get_url;
                console.log(returnValue); // "not_null"
            }); 
            console.log(returnValue);  // "null"
            return returnValue;
        }
Why function don't return "not_null" ?
 
     
    