Have you have any idea how to get photos.photo array as JSON object in jquery?

function searchPhotos(q) {
        
var qEncoded = encodeURIComponent(q)
var requestOptions = {

        method: 'GET',

        redirect: 'follow',

        };

        

        fetch('https://api.flickr.com/services/rest/?method=flickr.photos.search&api_key=KEY_FLICKR_HERE&tags='+qEncoded+'&format=json&per_page=6', requestOptions)

        .then(response => response.text())

        .then(result => console.log(result))

        .catch(error => console.log('error', error));
}

have you have any idea how to get photos.photo array as JSON object in jquery???

jsonFlickrApi({“photos”:{“page”:1,“pages”:167424,“perpage”:6,“total”:“1004540”,“photo”:[{“id”:“49886371603”,“owner”:“34725795@N00”,“secret”:“f9ae0cee89”,“server”:“65535”,“farm”:66,“title”:"_SDI3633a",“ispublic”:1,“isfriend”:0,“isfamily”:0},{“id”:“49885941983”,“owner”:“92655017@N02”,“secret”:“6e759d473e”,“server”:“65535”,“farm”:66,“title”:". . @prilaga #catoftheday #sleeping #fun #petsagram #kitty #smile #instagramcats #adorable #catlover #furry #kittens #instacat #cats #catstagram #lovecats #catsagram #ilovemycat #instagood #animal #photooftheday #animals #nice #lovekittens #cat #kitten #p",“ispublic”:1,“isfriend”:0,“isfamily”:0},{“id”:“49886080836”,“owner”:“94367390@N04”,“secret”:“7fc6b2f5fa”,“server”:“65535”,“farm”:66,“title”:“1.310 - Vicky”,“ispublic”:1,“isfriend”:0,“isfamily”:0},{“id”:“49885003838”,“owner”:“21331993@N05”,“secret”:“571e3fdcd6”,“server”:“65535”,“farm”:66,“title”:“IMG_2372”,“ispublic”:1,“isfriend”:0,“isfamily”:0},{“id”:“49884986663”,“owner”:“33244024@N06”,“secret”:“c291802c44”,“server”:“65535”,“farm”:66,“title”:“Cat Close-Up”,“ispublic”:1,“isfriend”:0,“isfamily”:0},{“id”:“49885772932”,“owner”:“186918920@N04”,“secret”:“5915e0ca5e”,“server”:“65535”,“farm”:66,“title”:“Caringbah Vet”,“ispublic”:1,“isfriend”:0,“isfamily”:0}]},“stat”:“ok”})

Have you tried looking at their documentation?

how get data inside …
jsonFlickrApi( … ) ??
result is this…
.then(result => console.log(result))
I looked in docs but the problem result.photos.photo Not give array but undefined
and result.photos undefined

https://www.flickr.com/services/rest/?method=flickr.photos.search&api_key=KEY_HERE&tags=iron&format=json&nojsoncallback=1

SOLVED
REMOVED:
jsonFlickrApi( … )
BY using in url nojsoncallback=1

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.