i keep getting something i can't find out how to solve. When i run the code it tells me "Uncaught TypeError: Cannot read property 'length' of undefined". With a lot of search and reading i did not find the answer it mentions that i need to use the length of the value with a for command but i tried several solutions none of them solved the problem, this is the code:
function Cast() {
$.ajax({
type: "Get",
url: "http://www.myapifilms.com/imdb/idIMDB?idIMDB=tt2193418&token=<TOKEN>&format=json&callback=?&actors=2",
dataType: "json",
success: function (Result)
{
$.each(Result.actors, function (i, item) {
$('.div').append('<tr><td>' + Result.actors[i].actorName + '</td></tr>');
});
},
error: function () {
console.log("Error, Something went wrong!");
}
});
}
the response i get from postman:
{
"data": {
"movies": [
{
"title": "Hammer of the Gods",
"simplePlot": "A young man transforms into a brutal warrior as he travels the unforgiving landscape in search of his long lost brother, Hakan the Ferrocious, whose people are relying on him to restore order to their kingdom.",
"actors": [
{
"actorName": "Charlie Bewley",
},
{
"actorName": "Clive Standen",
etc.