I would like to retrieve a variable outside an anonymous function, At the moment, I have this :
function recupererFichier(callback, params){
    $.ajax({
        url : 'map.php',
        dataType: 'json',
        success: function (data) {
            //console.log(data)
            callback(data, params);
        }
    });
}
function test() {
var recup = [];
    recupererFichier(
        function (data, params) {
            console.log(recup)
            console.log("data", data.length);
            for (var i = 0; i < data.length; i++){
                recup[i] = data[i];
            }
            console.log(recup) //["breche_de_roland_.gpx", "casque_lheris_.gpx", "col_d_arrious.gpx", "lac_combales.gpx", "lac_d_isabe_.gpx", "lac_de_gaube_.gpx", "lac_de_pombie_.gpx", "pic_midi_de_bigorre.gpx", "refuge_lac_migouelous.gpx", "refuge_wallon.gpx", "tour_des_lacs_-_lac_d_ayous_.gpx"]
        });
    //Retrieve array here
    console.log(recup) //undefined
}
I want to get the array generated, outside the anonymous function. That is possible ? Thanks
