I'm encountering an issue with a JavaScript FileReader that is giving me the error message Uncaught TypeError: Failed to execute 'readAsDataURL' on 'FileReader': parameter 1 is not of type 'Blob'.
Below is the snippet of JavaScript causing the problem:
var blob = null;
var xhr = new XMLHttpRequest();
xhr.open("GET", "C:\\Users\\yw1kew\\Desktop\\LG_FRAME.plmx");
xhr.responseType = "blob";
xhr.onload = function() {
blob = xhr.response;
}
xhr.send();
var myReader = new FileReader();
myReader.readAsArrayBuffer(blob) // THE ERROR OCCURS HERE
Any suggestions on how to resolve this issue? Thank you.