Created
May 21, 2012 02:44
-
-
Save jlengstorf/2760364 to your computer and use it in GitHub Desktop.
#13 Code example from "JSON: What It Is, How It Works, & How to Use It"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function loadFlickr(flickrid) | |
{ | |
// Display a loading icon in our display element | |
$('#feed').html('<span><img src="/blog/images/lightbox-ico-loading.gif" alt=""></span>'); | |
// Request the JSON and process it | |
$.ajax({ | |
type:'GET', | |
url:"http://api.flickr.com/services/feeds/photos_public.gne", | |
data:"id="+flickrid+"&lang=en-us&format=json&jsoncallback=?", | |
success:function(feed) { | |
// Create an empty array to store images | |
var thumbs = []; | |
// Loop through the items | |
for(var i=0, l=feed.items.length; i < l && i < 16; i) | |
{ | |
// Process each image | |
} | |
// Display the thumbnails on the page | |
}, | |
dataType:'jsonp' | |
}); | |
} |
$('#feed').
= {Ruthann 28 Kentucky} http://api.flickr.com/services/feeds/photos_public.gne
id="+flickrid+"&lang=en
//THUMBS ()
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
$('#feed').html('');
$.ajax({
type:'GET',
url:"http://api.flickr.com/services/feeds/photos_public.gne",
data:"id="+flickrid+"&lang=en-us&format=json&jsoncallback=?",
success:function(feed) {
// thumbs {}
=1 length; i < l && i < 16; i)
{ dataType:'jsonp'
});
}