Reading the JSON response from the Giphy

687 Views Asked by At

I am trying to read the results from a $.getJSON() request.

The results are here...

http://api.giphy.com/v1/gifs/search?q=funny+cat&api_key=dc6zaTOxFJmzC&limit=1&offset=0

I am trying to get the value of bitly_gif_url using

$.each(data, function(index) {
            console.log(data[index].bitly_gif_url);
        });

But it just returns undefined. I have tried different ways to get to the data but i am struggle and kindly request any suggestions thanks

1

There are 1 best solutions below

1
On

If your domain is not http://api.giphy.com, then you are trying to make a cross-domain Ajax request. Cross-domain requests are prohibited by most browsers. Please read more at http://api.jquery.com/jQuery.ajax/ -> crossDomain