I'm having trouble displaying the content of a json file (books.json) as a list on my website using VUE. Here is the code I'm currently working with:
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
<html>
<head>
<script src="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="4234372702706c776c7375">[email protected]</a>/dist/vue.js"></script>
</head>
<body>
<div id="app">
<span>{{items}}</span>
<ul>
<li v-repeat="items">
<span class="name">{{books.name}}</span><br>
<span class="genre">{{books.genre}}</span>
</li>
</ul>
</div>
</body>
<script>
var app= new Vue({
data: {
items: null
},
created: function () {
this.fetchData();
},
methods: {
fetchData: function () {
var self = this;
$.get( 'books.json', function( data ) {
self.items = data;
});
}
}
});
</script>
</html>
Could someone assist me with this issue, please? Thank you