https://envincebal.github.io/api-hack/index.html
Hey everyone, I pushed my api project on github's gh-page hosting. The link is right above. Everything works except the images are broken. The images work when I run the project locally. On the console, it gives an error message "GET https://envincebal.github.io/uploads/scale_large/8/82063/2267410-fusion.jpg 404 (Not Found)"
Any help would be greatly appreciate.
Here's my code: *SIDE NOTE: The "http" protocol was removed from the endpoint because it caused an error when making a request while on the hosted site.
$("#search").submit(function(event) {
event.preventDefault();
var userInput = $("#query").val();
getRequest(userInput);
});
function showResults(result) {
var html = "";
$.each(result.results, function(index, value) {
var gameName = value.name;
var boxArt = value.image ? value.image.super_url : '';
var summary = value.deck;
var site_detail = value.site_detail_url;
html += "<li><p class='game-title'>" + gameName + "</p>" + "<img src=" + boxArt + " class='game-image'>" + "<p class='game-summary'>" + summary + "</p>" + "<a href='" + site_detail + "' ><p class='game-details'>Click for more information</p></a></li>";
});
$("#search-results").html(html);
}
function getRequest(userInput){
$.ajax({
url: "http://www.giantbomb.com/api/search",
type: "GET",
data: {
resources: "game",
query: userInput,
api_key: "8cd10a7136710c1003c8e216d85941ace5a1f00e",
format: "jsonp",
crossDomain: true,
limit: 15,
field_list: "deck,name,image,site_detail_url",
json_callback: 'showResults'
},
dataType: "jsonp"
}).done(function(data) {
showResults(data.results);
console.log(data);
});
}
Log in to comment