function displayGifs(){
    var animal = $(this).attr("data-name");
    var queryURL = "http://api.giphy.com/v1/gifs/search?q=" + animal + "&api_key=dc6zaTOxFJmzC&limit=10";
    console.log(queryURL);
    $.ajax({
        url: queryURL,
        method: 'GET'
    })
    .done(function(response) {
        console.log(response);
        $("#gifsView").empty(); 
        var results = response.data;
        for (var i=0; i<results.length; i++){

            var gifDiv = $("<div>");
            gifDiv.addClass("gifDiv");
            var gifRating = $("<p>").text("Rating: " + results[i].rating);
            gifDiv.append(gifRating);
            var gifImage = $("<img>");
            gifImage.attr("src", results[i].images.fixed_height_small_still.url);
            gifImage.attr("data-still",results[i].images.fixed_height_small_still.url); 
            gifImage.attr("data-animate",results[i].images.fixed_height_small.url);
            gifImage.attr("data-state", "still");
            gifImage.addClass("image");
            gifDiv.append(gifImage);
            $("#gifsView").prepend(gifDiv);
        }
    });
}
// Function that displays all of the gifs
Function that displays all of the gifs
Function that displays all of the gifs
function displayGifs(){
    var animal = $(this).attr("data-name");
    var queryURL = "http://api.giphy.com/v1/gifs/search?q=" + animal + "&api_key=dc6zaTOxFJmzC&limit=10";
    console.log(queryURL);
    $.ajax({
        url: queryURL,
        method: 'GET'
    })
    .done(function(response) {
        console.log(response);
        $("#gifsView").empty(); 
        var results = response.data;
        for (var i=0; i<results.length; i++){
            var gifDiv = $("<div>");
            gifDiv.addClass("gifDiv");
            var gifRating = $("<p>").text("Rating: " + results[i].rating);
            gifDiv.append(gifRating);
            var gifImage = $("<img>");
            gifImage.attr("src", results[i].images.fixed_height_small_still.url);
            gifImage.attr("data-still",results[i].images.fixed_height_small_still.url); 
            gifImage.attr("data-animate",results[i].images.fixed_height_small.url);
            gifImage.attr("data-state", "still");
            gifImage.addClass("image");
            gifDiv.append(gifImage);
            $("#gifsView").prepend(gifDiv);
        }
    });
}
function displayGifs ( ) { var animal = $ ( this ) . attr ( "data-name" ) ; var queryURL = "http://api.giphy.com/v1/gifs/search?q=" + animal + "&api_key=dc6zaTOxFJmzC&limit=10" ; console . log ( queryURL ) ; $ . ajax ( { url : queryURL , method : 'GET' } ) . done ( function ( response ) { console . log ( response ) ; $ ( "#gifsView" ) . empty ( ) ; var results = response . data ; for ( var i = 0 ; i < results . length ; i ++ ) { var gifDiv = $ ( "<div>" ) ; gifDiv . addClass ( "gifDiv" ) ; var gifRating = $ ( "<p>" ) . text ( "Rating: " + results [ i ] . rating ) ; gifDiv . append ( gifRating ) ; var gifImage = $ ( "<img>" ) ; gifImage . attr ( "src" , results [ i ] . images . fixed_height_small_still . url ) ; gifImage . attr ( "data-still" , results [ i ] . images . fixed_height_small_still . url ) ; gifImage . attr ( "data-animate" , results [ i ] . images . fixed_height_small . url ) ; gifImage . attr ( "data-state" , "still" ) ; gifImage . addClass ( "image" ) ; gifDiv . append ( gifImage ) ; $ ( "#gifsView" ) . prepend ( gifDiv ) ; } } ) ; }
Function that displays all of the gifs
Function that displays all of the gifs