<script>
var app = new Vue({
el: '#app',
data: {
topscorers: []
},
created() {
fetch("https://sportsop-soccer-sports-open-data-v1.p.rapidapi.com/v1/leagues/%7Bleague_slug%7D/seasons/%7Bseason_slug%7D/topscorers", {
"method": "GET",
"headers": {
"x-rapidapi-host": "sportsop-soccer-sports-open-data-v1.p.rapidapi.com",
"x-rapidapi-key": "4345984802msh66e6938db04b178p12dea9jsn83a6f1683119"
}
})
.then(response => {
console.log(response);
})
.catch(err => {
console.log(err);
});
}
})
</script>
<table class="table table-bordered">
<thead>
<tr>
<th scope="col">Player ID</th>
<th scope="col">Name</th>
<th scope="col">Matches</th>
<th scope="col">Position</th>
<th scope="col">Nationality</th>
<th scope="col">Team Name</th>
<th scope="col">Goals</th>
</tr>
</thead>
<tbody>
<tr v-for="topscorer in topscorers">
<td>{{ topscorer.player_id }}</td>
<td>{{ topscorer.fullname }}</td>
<td>{{ topscorer.matches }}</td>
<td>{{ topscorer.position }}</td>
<td>{{ topscorer.nationality }}</td>
<td>{{ topscorer.team }}</td>
<td>{{ topscorer.goals }}</td>
</tr>
</tbody>
</table>
.then(response => {
console.log(response);
})
var app = new Vue({
el: '#app',
data: {
topscorers: []
},
created() {
fetch("https://sportsop-soccer-sports-open-data-v1.p.rapidapi.com/v1/leagues/%7Bleague_slug%7D/seasons/%7Bseason_slug%7D/topscorers", {
"method": "GET",
"headers": {
"x-rapidapi-host": "sportsop-soccer-sports-open-data-v1.p.rapidapi.com",
"x-rapidapi-key": "4345984802msh66e6938db04b178p12dea9jsn83a6f1683119"
}
})
.then(responseJSON => {
return responseJSON.json()
})
.then(response => {
this.topscorers = response.data.topsorers
})
.catch(err => {
console.log(err);
});
}
})