I have a text box and a search button. Based on user input, I want to query Giphy api to fetch matching Gifs. but my ajax call always going to error. Can anybody help me,
$('#button2').click(function() {
var srchParam = $('#srcCriteria').val();
$.ajax({
url: "http://api.giphy.com/v1/gifs/search?q=dog&api_key=dc6zaTOxFJmzC",
type: "GET",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(response) {
alert("hello");
//console.log(response.data[0].bitly_url);
},
error: function(xhr, status, error) {
alert("bye");
}
});
});
Here is the jsfiddle link: https://jsfiddle.net/Appy169/faedybhf/12/