Skip to content

Instantly share code, notes, and snippets.

@rahman541
Created August 1, 2018 04:37
Show Gist options
  • Save rahman541/2157d91868ca0e5548501e8f73619238 to your computer and use it in GitHub Desktop.
Save rahman541/2157d91868ca0e5548501e8f73619238 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<div id="app">
{{ status }}
</div>
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vue"></script>
<script>
var vm = new Vue({
el: '#app',
data: {
status: 'hello world'
},
methods: {
loadQuote: function() {
this.status = 'Loading quotes...';
axios.get('http://ron-swanson-quotes.herokuapp.com/v2/quotes')
.then((res) => {
this.status = res.data[0];
}).catch((res) => {
this.status = 'Error fetching quotes';
})
}
},
created: function() {
this.loadQuote();
}
})
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment