I am trying to read the text of a file with Javascript/JQuery.
However I am unable to return the data to my main function. The "console.log" works but not the "return str".
MyFile = function() {
};
MyFile.readFile = function(file) {
var str = "";
$.get(file, {}, function(data) {
str = data;
console.log(str);
}, "text");
return str;
};