i trying json
data 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, encountering issue whereby getting 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 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); } }); }
it seems it's because directly accessing html. have since moved host on localhost. it's still having error, without description now...
after shifting function call after function definition, getting error.
you should use console.log instead of alert. logging console allow investigate objects being returned.
since ajax call , error handler being called, it's status of response not 200.
Comments
Post a Comment