Trying to give a src attribute to a created element. The src should be a url retrieved from the giphy api. I can console.log the response data and everything is fine, however I cannot seem to get the jQuery for creating an element to house the gif correct.
$('.spawn-button').on("click", function(event) { event.preventDefault(); $.ajax({ url: query + $(this).html() + APIKey + limit, method: 'GET' }).done(function(response) { for(var i = 0; i < response.data.length; i++){ // console.log(response.data[i]); // console.log(response.data[i].images.original); $('.gif-container').append("<img src=" + response.data[i].images.fixed_height + ">"); } }); });
response$('.gif-container').append("<img src='" + response.data[i].images.fixed_height +"'>"); }fixed_heightis an object, so I'm not sure exactly what you're trying to appendresponse.data[i].images.fixed_height.url