How do I load external JSON from a script on a web page?
that data file doesn't have company_url
entry. Additionally, the .js
file is served with text/javascript
mime-type, when it should be served with application/json
(or application/x-javascript
, correct me on that).
The real reason, of course, is that you need to add ?callback=?
to your url. Then everything is going to work. So, it'll look like this:
$(document).ready(function(){
$.getJSON("http://api.crunchbase.com/v/1/company/xobni.js?callback=?",
function(data){
alert(data.homepage_url);
});
});
I looked at the json data. It looks like there is no company_url. You might want homepage_url
$(document).ready(function(){
$.getJSON("http://api.crunchbase.com/v/1/company/xobni.js",
function(data){
alert(data.homepage_url);
});
});