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;
}
问问题
73 次