Reputation: 205
I'm trying to make a request to flickr with ultimate failure. Not sure what I'm doing wrong and hope someone can point me in the right direction. I looked up the documentation, the flickr documentation is not really beginner friendly. here's what I have so far:
<script type="text/javascript">
var key = 'myKeyhere';
$.ajax({
url: 'http://api.flickr.com/services/rest/?&method=flickr.people.getPublicPhotos&api_key='+myKeyhere+'&user_id=12345&format=jsonp',
jsonpCallback: 'jsonCallback',
contentType: "application/json",
dataType: 'jsonp',
sucess: function(data) {
console.log(data);
}
});
</script>
Upvotes: 0
Views: 109
Reputation: 4353
There are couple of issue. Try the below. I have switched to echo test method of flikr for testing purpose. You need to define callback method jsonFlickrApi and switch https protocol. Specify format as json in url, else Flickr will return xml data which will tough to handle with jsonp calls.
<script type="text/javascript">
$.ajax({
url: 'https://api.flickr.com/services/rest/?method=flickr.test.echo&name=value&api_key='+api key+'&format=json',
dataType: 'jsonp'
});
function jsonFlickrApi (response) {
console.log(response);
}
</script>
Upvotes: 1