0
I’m not being able to return the json via ajax, I tried with console.log but it’s returning the function itself that I built
function (){
var json = null;
$.ajax({
async: false,
global: false,
url: "http://localhost:8000/uf/",
type: 'GET',
dataType: 'json',
success: function (data) {
json = data;
console.log(json);
}
});
return json;
}here
How do I return the json I’ve assembled before?
All this is to generate the graph, but it is not reading the json correctly.
I am following the tutorial of this site
https://www.daniweb.com/programming/web-development/threads/477322/morris-chart-with-dynamic-data
Does this url you are pointing to have the data you need in JSON format? Try to take the result of this url and test it in some validator to see if it really is in the correct JSON format. (validator: http://jsonlint.com/). One way to get the result of the url is: If you use Google Chrome, press F12 and in the "Network" tab you can see the returns of Ajax, look at the image: http://prntscr.com/94dr9o
– Thiago Yoithi