Reputation: 177
Can anyone help me, im trying to get this information from facebook:
https://graph.facebook.com/139373546157232/
This is my ajax call, but im getting a 200 bad request in the chrome error console and the following error:
XMLHttpRequest cannot load https://graph.facebook.com/139373546157232/. Origin http://delete-cardiff.co.uk is not allowed by Access-Control-Allow-Origin.
$.ajax({
url : "https://graph.facebook.com/139373546157232/",
success : function(data) {
//Checking what's returned
console.log(data);
},
dataType : "json"
});
My understanding was I didn't need authentication to get this information? How would I go about retrieving the object?
Thanks
Upvotes: 0
Views: 420
Reputation: 84140
You can't retrieve JSON from an external URL. You need to use JSONP. In jquery, if you include callback=? at the end of your URL then it will work. Try:
$.ajax({
url : "https://graph.facebook.com/139373546157232/?callback=?",
success : function(data) {
//Checking what's returned
console.log(data);
},
dataType : "json"
});
Upvotes: 2