Flickr API Error, Json Callback

why I have such an error in my code:

"Error: jsonFlickrApi not defined"

    $.getJSON('http://api.flickr.com/services/rest/?method=flickr.photosets.getPhotos&api_key=669158895706254986e97354a3c7e9a9&photoset_id=72157623477817483&extras=original_format&format=json&jsoncallback;=?',
    function(data){
        var classShown = 'class="lightbox"';
        var classHidden = 'class="lightbox hidden"';


        $.each(data.photoset.photo, function(i, rPhoto){
            var basePhotoURL = 'http://farm' + rPhoto.farm + '.static.flickr.com/'
                + rPhoto.server + '/' + rPhoto.id + '_' + rPhoto.secret;
......

there are problems with syme in the JSON data type or something else, suggest me how to fix it, pls

thank

+3
source share
1 answer

The end of your url is a bit off, this is:

....&jsoncallback;=?

Must be:

....&jsoncallback=?

jQuery fills this method with its own with a dynamically named function (yours is function(data)converted to this named function or JSONP to work). Since the format is off, it will not replace it correctly, and the default method is jsonFlickrApi.

url ( ), , :

jsonFlickrApi({ ... })

( URL), :

myFunction({ ... })

, jQuery, - URL- ?, , , .

+6

Source: https://habr.com/ru/post/1759457/


All Articles