I am attempting to programmatically load a local JavaScript file - PapaParse library, and then utilize one of its functions:
$.getScript("./Content/Scripts/papaparse.js", function () {
console.log("Papaparse loaded successfully");
Papa.parse(file, { skipEmptyLines: true, header: false, complete: completeCallback });
});
The script loads successfully, but when I try to call the parse method, it throws an error:
ReferenceError: Papa is not defined
Within the PapaParse library, Papa is defined like this:
(function (global) {
"use strict";
var Papa = {};
Papa.parse = someFunction;
.
.
global.Papa = Papa;
}
If it helps, this entire code is called from a TypeScript file.
What could be the issue here?