Code to load images from Flickr public gallery images using JSONP API. You can search using tags/keywords or specific users photos to display on your site.

What is JSONP API?

jQuery-JSONP is a compact (1.7kB minified), yet feature-packed, alternative solution to jQuery’s implementation of JSONP.
jQuery-JSONP Features:
* error recovery in case of network failure or ill-formed JSON responses,
* precise control over callback naming and how it is transmitted in the URL,
* multiple requests with the same callback name running concurrently,
* two caching mechanisms (browser-based and page based),
* the possibility to manually abort the request just like any other AJAX request,
* a timeout mechanism.
Official JSONP Site
Download Page

Load Flickr Pictures using JSONP API

This code loads all the publis photos matching the tags:

< !DOCTYPE html>



What a typical Flickr JSON object looks like

    "title": "Talk On Travel Pool",
    "link": "http://www.flickr.com/groups/talkontravel/pool/",
    "description": "Travel and vacation photos from around the world, featured on the Talk On Travel blog. Join us in sharing your favourite destinations, your top hot spots, and the places to avoid. ",
    "modified": "2009-02-02T11:10:27Z",
    "generator": "http://www.flickr.com/",
    "items": [
            "title": "View from the hotel",
            "link": "http://www.flickr.com/photos/33112458@N08/3081564649/in/pool-998875@N22",
            "media": {"m":"http://farm4.static.flickr.com/3037/3081564649_4a6569750c_m.jpg"},
            "date_taken": "2008-12-04T04:43:03-08:00",
            "description": "

Talk On Travel< /a> has added a photo to the pool:< /p>

View from the hotel< /a>< /p> ", "published": "2008-12-04T12:43:03Z", "author": "nobody@flickr.com (Talk On Travel)", "author_id": "33112458@N08", "tags": "spain dolphins tenerife canaries lagomera aqualand playadelasamericas junglepark losgigantos loscristines talkontravel" } ] })

Great Tutorial on Flickr JSONP API

Tags: flickr tags json api, jsonp api, load flickr pics json api
Sam Deering is a Front-end Web Developer who specialises in JavaScript & jQuery. Sam is driven and passionate about sharing his knowledge to educate others.

Free Guide:

How to Choose the Right Charting Library for Your Application

How do you make sure that the charting library you choose has everything you need? Sign up to receive this detailed guide from FusionCharts, which explores all the factors you need to consider before making the decision.

Special Offer
Free course!

Git into it! Bonus course Introduction to Git is yours when you take up a free 14 day SitePoint Premium trial.