How to get the return array back from an ajax function call using jquery?
<pre><code>var testFile = $("#selection").val(),
    testData = getTestData(testFile); 

// not working during the first time I run the function, empty
alert(testData); 

function getTestData(testF) {
    $.getJSON("test.php", {
        fileTest: testF
    }, function (data) {
        $.each(data, function (index, value) {
            if (value != "") {} else {
                testArray[index] = value;
            }
        });
    });

    // working I see the values
    alert(testArray); 

    // not working the first time running this function
    return testArray; 
}​
</code></pre>
