Cross Domain Facebook getJson jQuery not bringing back data
Is there any reason at this doesnt work:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
var url = "https://graph.facebook.com/search?q=cinema&type=place¢er=37.76,122.427&distance=1000";
$.getJSON(url, function(data) {
alert(data);
});
});
</script>
I should point out, that it doesnt return anything, not that its bringing back the wrong results,开发者_运维问答 none are returned.
is it because it's cross domain or not?
Thanks
Cross-domain requests require using JSONP. Either add a callback=
URL parameter (if the web API supports it) or use jQuery.ajax
with the dataType: "jsonp"
parameter (search the jQuery.ajax documentation for "dataType").
Try putting in an error argument in the function (function(data,error,er) and alert these as well to try and capture the problem.
精彩评论