Reputation: 5060
I'm using this code in a Jquery mobile website. However, it's return me an error with
{readyState: 0, status: 0, statusText: "Error: NETWORK_ERR: XMLHttpRequest Exception 101"}
I stuck here and can't find out what is the problem ! and i didn't found a good answer.
$(function () {
calldata();
});
function calldata() {
var url = "http://www.mywebsite.com/json.php" ;
var json = (function () {
var json = null;
$.ajax({
'async': false,
'global': false,
'url': url,
'error': function (data) { console.log(data); },
'success': function (data) {
json = data;
console.log(data);
}
});
return json;
})();
}
Upvotes: 2
Views: 4355
Reputation: 5060
Solved =P
$.ajax({
'async': false,
'global': false,
'dataType': 'JSON', // this line was missing
'url': url,
'error': function (data) { console.log(data); },
'success': function (data) {
json = data;
console.log(json);
}
});
Upvotes: 3