I am trying to set the value of a variable from inside a $.get jquery call but it is not working. Below is my code
var uData = [];
$('#tfriends').click(function () {
    get_json(function () {                     
       alert(uData);
    });
});
function get_json(callback) {
    $.get('url', function (data) {
        var data = $.map(data.result, function (obj) {
            obj.Id = obj.Id || obj.name;
            obj.text = obj.text || obj.name;
            return obj;
        }, "json");
        uData = data;
    });
 }
 
     
     
    