I'm trying to get a JSON, hosted in a local server here, but for some reason it doesn't work. If i hit my url on the browser it returns the Json correctly and If I use another URL, I do get some data.
My original getJson method:
getJson:
$.getJSON(url,
function(data) {
console.log('got something');
alert(data);
});
Now I want to see exactly what's wrong. I've rewritten it as a Ajax request, and on my error callback jqxhr gives me a lot of things that I don't understand. Can i get more details about this error ?
TextStatus
value is error
errorThrown
is null
$.ajax({
url: url,
dataType: 'json',
success: function(data) {
console.log('got something');
alert(data);
},
error: function(jqxhr,textStatus,errorThrown)
{
console.log(jqxhr);
console.log(textStatus);
console.log(errorThrown);
for (key in jqxhr)
alert(key + : + jqxhr[key])
for (key2 in textStatus)
alert(key + : + textStatus[key])
for (key3 in errorThrown)
alert(key + : + errorThrown[key])
//<--- All those logs/alerts, don't say anything helpful, how can I understand what error is going on? ---->
}});
Last, the json i'm supposed to get back is
[{message: login failed}]
And I can't use firebug, chrome console, or any other dev tools because this is a mobile app, developed using Phonegap!