I want to read the text file from javascript but fileReader.onload is not getting called hence str is coming as null.
if (window.File && window.FileReader && window.FileList && window.Blob)
{
    var fileReader = new FileReader();
    fileReader.onload = function(e) {
      text = fileReader.result;
    };  
    var file = new File([""],"C:\\Users\\Swap\\Desktop\\1.txt");
    fileReader.readAsText(file); 
    var str = text;
    alert(str); 
} 
else 
{ 
     alert("Files are not supported"); 
} 
