I am trying to write a HTML5 mobile application and use jQuery to get a json from the url http://cin.ufpe.br/~rvcam/favours.json I tried using
var url='http://cin.ufpe.br/~rvcam/favours.json';
$.getJSON(url, function(data, status)
{
console.log(data);
console.log(status);
});
but nothing shows up on the console. I don't see what I am doing wrong.
[EDIT] I learned from another post that I can't normally retrieve information from another server. But this server in particular (cin.ufpe.br/~rvcam) is mine. Can I use PHP or some other method to allow my application to retrieve the data?
.fail()callback and see if it's raising an error. The arguments will match$.ajax()'serroroption --(xhr, status, error).foo()will need to be removed from the file so that it's just JSON and the server will need to respond with CORS headers that allow the request.$.ajax(url, {dataType:"jsonp",jsonpCallback:"foo"}).done(function(data) {...});will tell jQuery to expect jsonp with the callback namefoo.