Ajax检查文件

I'm trying to build a table with three columns.

Burmese   /   English   /  exists
some word /  some def   / yes
next      /  next      /  yes
last      /   last      / no
third     /  third     /  no
fourth    /  fourth    /  yes
etc.      /   etc.     /  etc

Basically I was the loop to send a get request for the file, and if it exists (success) set var exists to "Does Exist", and if it doesn't exist, set var exists to "Does not Exist".

somefunction() {
var mySecondArray = "an array that I've created and works fine";
n = mySecondArray.length;
  for (var i = 0; i < n; i++) {
     var exists = "Exists";
     var something = $.get("/static/audio/ChinState/"+mySecondArray[i].key+".ogg")
                    .done(function() {
                        exists = "Does not Exist";
                        return exists;
                     }).fail(function() {
                         exists = "Does Exist";
                        return exists;
                     });
                       $("table#vocabTable").append("<tr><td>"+mySecondArray[i].key+"</td><td>"+mySecondArray[i].value+"</td><td>"+exists+"</td></tr>");    
 }
}

It appears that the table is getting created before the call finishes, so then I tried this.

  somefunction() {
  var mySecondArray = "an array that I've created and works fine";
  n = mySecondArray.length;
    for (var i = 0; i < n; i++) {
        var exists = "Exists";
        var something = $.get("/static/audio/ChinState/"+mySecondArray[i].key+".ogg")
                    .done(function() {
                        exists = "Does not Exist";
                       $("table#vocabTable").append("<tr><td>"+mySecondArray[i].key+"</td><td>"+mySecondArray[i].value+"</td><td>"+exists+"</td></tr>");
                     }).fail(function() {
                         exists = "Does Exist";
                       $("table#vocabTable").append("<tr><td>"+mySecondArray[i].key+"</td><td>"+mySecondArray[i].value+"</td><td>"+exists+"</td></tr>");
                     });
    }
 }

but then it says mySecondArray[i] is undefined. So I tried passing in mySecondArray and i to the function, but same result.

Any ideas on this?