I can't figure out why neither readSuccess()
or readFailure()
are getting called in the following:
function readMyFile(){
var reader = new FileReader();
reader.onload = readSuccess;
reader.onerror = readFailure;
reader.readAsText("test.txt");
function readSuccess(evt){
alert(evt.target.result);
}
function readFailure(evt) {
alert("Did not read file!");
}
}
When I step though the code in the Chrome javascript debugger, it steps past the reader.readAsText("test.text");
command, but then exits the whole function, never calling readSuccess()
or readFailure()