I'm trying to consume an API and the $ http.get only returns NULL. I call a PHP that returns a json
What nonsense am I doing?
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.1.7/vue.js"></script>
<script src="https://cdn.jsdelivr.net/vue.resource/1.0.3/vue- resource.min.js"></script>
<div id="app">{{cervejarias}}</div>
new Vue({
el:'#beerApp',
data:{
cervejarias: null
},
methods:{
getChamados: function(){
this.$http.get('listar_cervejarias.php').then(function(response){
this.cervejarias = response.data;
}, function(error){
console.log(error.statusText);
});
}
},
mounted: function () {
this.getChamados();
}
});
Consider adding:
To your PHP pages.