I have this data inside a JSON:
{"minmax":["0.01","67.00"]}
And I want to get it using jQuery, this is what I am doing:
$.getJSON("../../dados/opcoesMinMax.json", function(data) {
var getMinMax = data;
});
// Need to use data here, out of the scope
I also tried to do it using callback, doing this:
function getMinMax(callback) {
$.getJSON("../../dados/opcoesMinMax.json", function(data) {
callback(JSON.stringify(data));
});
}
// Need to use data here, out of the scope
Even using callback, I cannot recover data. console.log(getMinMax); returns me the function.
and console.log(getMinMax()); returns me undefined and says callback is not a function.