I create one javascript file and call JSON from there. Before I use JSON, I use hardcode data and it works. But I try to load data using $JSON, somehow it does not work. Check the code below
$(function(){
function drawStackBar(){
console.log('@ draw ');
$.getJSON("{!$Page.JSONFile}", {"core.apexpages.devmode.url" :'0'}, function(data) {
var jsonData=data;
console.log(' jsonData '+jsonData);
});
}
drawStackBar();
});
It only print until '@ draw'. I already checked the JSON file manually, it contains the data. What did I do wrong? Last time I remember, I put the function in Visualforce and it worked. Is it different if we put the function in separate javascript and store it in Static Resource?
Thanks a lot.
.fail(function(err){console.log('error : '+ err);})
method to the getJSON and check if there's any error..