function CallAPI(page) {
$.ajax({
url: "http://food2fork.com/api/search?q=chicken",
data: { "key": "d270f61c8c9fe2ef89633f4b609966de" },
dataType: "json",
success: function (result, status, xhr) {
var resultHtml = $("<div class=\"resultDiv\"><p>Names</p>");
for (i = 0; i < result["recipes"].length; i++) {
var image = result["recipes"][i]["profile_path"] == null ? "Image/no-image.png" : "https://image.tmdb.org/t/p/w500/" + result["recipes"][i]["profile_path"];
resultHtml.append("<div class=\"result\" resourceId=\"" + result["recipes"][i]["id"] + "\">" + "<img src=\"" + image + "\" />" + "<p><a>" + result["recipes"][i]["label"] + "</a></p></div>")
}
resultHtml.append("</div>");
$("#message").html(resultHtml);
Paging(result["total_pages"]);
},
error: function (xhr, status, error) {
$("#message").html("Result: " + status + " " + error + " " + xhr.status + " " + xhr.statusText)
}
});
}
I'm trying to display data from this API call, but I get Result: error 0 error, the bees are from http://food2fork.com
Names
"); for (i = 0; i < result["recipes"].length; i++) { resultHtml.append("") }