I'm trying to load a JSON file that I'll use as constants file, but I'm always getting the error undefined, could any one help?
Here is the code:
function loadJsonFile(filePath){
$.getJSON(filePath, function(Mydata) {
alert(Mydata.length);
return Mydata;
})
error(function() { alert("error");
});
The structure of constants file is:
{
"var1":"v1",
"var2":"v2"
}
Thank you in advance for your help.