I wanted to fetch data from web service with vue.js. But I can't take data.Is it possible to use vue.js without installing node.js? Can you help me please? Thank you in advance..
<!DOCTYPE html>
<html lang="en">
<head>
<title></title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="https://unpkg.com/[email protected]/dist/vue.js"></script> <script src="https://unpkg.com/[email protected]/dist/vue-resource.min.js"></script>
</head>
<body>
<div id="app">
<table border=1>
<thead>
<tr>
<th>title</th>
</tr>
</thead>
<tr id="app">
<td>{{data.title}}</td>
</tr>
</table>
</div>
<script type="text/javascript">
var dataURL = 'https://swapi.co/api/films/?format=json';
var App = new Vue({
el: '#app',
data: {
posts: [] // initialize empty array
},
mounted() {
var self = this
$.getJSON(dataURL, function(data) {
self.posts = data.results;
});
}
})
</script>
</body>
</html>