0
When running GET for PLAYLIST and VIDEO resources, I had a problem. When running GET on my console, the request correctly returns the values of the Owner.screenname and Owner.url attributes; however, when making the same request by AJAX (jQuery), these values are presented as Undefined (Google Chrome console). Could you tell me where I’m going wrong? I’m using the Dailymotion Data API. I’m calling from http://localhost: 8084 (Apache Tomcat)
Code:
$.ajax({
type: "GET",
url: "https://api.dailymotion.com/video/x26ezj5?fields=id,title,owner,owner.screenname,owner.url",
dataType: "json"
})
.done(function(data){
console.log(data.id);
console.log(data.title);
console.log(data.owner);
console.log(data.owner.screenname);
console.log(data.owner.url);
})
.fail(function(jqXHR, textStatus, errorThrown){
console.log(jqXHR.status + textStatus + errorThrown);
})
.always(function(data) {
console.log(data);
});
Chrome console:
x26ezj5
Greetings
x1fz4ii
undefined
undefined
{id: "x26ezj5", title: "Greetings", owner: "x1fz4ii", owner.screenname: "Dailymotion API", owner.url: "https://www.dailymotion.com/DailymotionAPI"}
Wagner, thank you for your contribution! I was able to solve by swapping: data.owner.screenname by date["Owner.screenname"] and data.owner.url by date["Owner.url"].
– CodeNow