I have this little piece of code
JS
function insertDataIntoTable(jsonUrl, Id) {
    var obj;
    $.getJSON(jsonUrl, function(data){
        console.log("1: "+data.elem[Id]);  //outputs the correct object
        obj= data.elem[Id];
        console.log("2: "+obj);            //still is correct
    });
    console.log("3: "+obj);                //now it logs "undefined"
}
which refers to a well-formed JSON which don't wanna post if not really necessary. I hope someone can help me anyway.
 
     
    