[Vuejs]-Vue.js update ajax data in data property variable

2👍

Add the extra line to your callback below.

this.$http.get(url).then(response => {
  this.resp = response.body;
  this.name = response.name
});

In your data just initialize it to null.

data(){  
  return {
    resp:[],
    name: null,
  }
}

Alternatively you could just use

{{resp.name}}

in your template.

👤Bert

Leave a comment