I am trying to get the json
data from a web API
http://www.streetdirectory.com/api/?mode=search&act=all&profile=sd_default&q=640724&limit=1&show_additional=0&output=json
Using ajax, I am encountering the issue whereby I am getting this error.
var addresses = new Array();
getAddress();
var myURL = "http://www.streetdirectory.com/api/?mode=search&act=all&profile=sd_default&q=640724&limit=1&show_additional=0&output=json";
function getAddress() { //get addresses from streetdirectory web API
$.ajax({
type: "GET",
url: myURL,
dataType: "json",
success: function(response){
addresses = response;
alert(response);
},
error: function(e) {
alert('Error: '+e);
console.log('Error: ' +e);
}
});
}
Updated with error on console.
It seems like it's because I am directly accessing the html. I have since moved it to host on my localhost. But it's still having the error, without any description now...
After shifting my function call to after my function definition, I am now getting this error.