-1
Hello, I’m trying to access a path coming from Sponse based on the name of the parameter I send via Onclick (I’m using Angularjs for this). I can’t concatenate the received parameter in the path of my Response, I have tried to convert it to OBJ or String and the maximum I got was the return of [obj obj]Param ( and I had to return the server response). In this case I am trying to concatenate the Champion parameter (sent from Onclick) in the server response, something like Response.data.data + {Champion}+ '.id'
However I can not get any return through this type of concatenation, I tried to split and join everything but it continues reading as string,
$scope.search = function (champion) {
$http({
method: 'GET',
url: 'http://ddragon.leagueoflegends.com/cdn/10.16.1/data/en_US/champion/' + champion + '.json'
}).then(function sucessCallBack(response) {
let name = "response.data.data"
let splitName = name.split(".")
let splitName2 = splitName.join(".")
console.log(response.data.data);
let champions = response.data.data + '.' + champion + '.id';
console.log(champions)
}).then(function errorCallBack(response) {
})
}
Then it returns basically a JSON with the data of the champion, I will fix the question to better help me.
– Glauco
Try this: Response.data.data[Champion]. id
– Thainam