TK123 TK123 - 2 months ago 17x
jQuery Question

How to get JSONP to work with jQuery?

I am trying to get some JSONP from the Flickr API to work with:

$.getScript('', function(data, textStatus, jqxhr) {

The alert gives
and the console says:

Uncaught ReferenceError: jsonFlickrFeed is not defined

Is there something wrong with the Flickr API response or is there a way to get this to work after all?


Try using jQuery.getJSON() instead like:

$.getJSON('', function(data, textStatus, jqxhr) {

You can see the Online API Documentation Demo


Live demo added here

// Set the flicker api url here
var flickerAPI = "";

// Set the tag display options
var options = {
  tags: "cats",
  format: "json"

// Get json format data using $.getJSON()
$.getJSON(flickerAPI, options)

// Api call success callback function
function OnApiCallSuccess(data) {
  $.each(data.items, function(i, item) {

    // Load only the first 6 images for demo
    if (i === 6) return false;

// Api call error callback function
function OnApiCallError(jqxhr, textStatus, error) {
  var err = textStatus + ", " + error;
  console.log("Request Failed: " + err);
img {
  height: 100px;
  float: left;
  padding: 0 10px 10px 0;
<script src=""></script>
<div id="images"></div>