Answer the question
In order to leave comments, you need to log in
How to update Vue component after receiving data from backend?
upd: Code https://jsfiddle.net/s7x9btm1/1/
I declare a component
new Vue({
el: '#twofamain',
data: {
twoFactory: false
},
Answer the question
In order to leave comments, you need to log in
Your this in success does not point to a Vue object. Do it like this:
created: function () {
var vueObj = this;
$.ajax({
url: "../php/getdashboard.php",
type: "POST",
data: {
emailLog:emailLog
},
success: function (res){
var obj = JSON.parse(res);
vueObj.twoFactory = Boolean(Number(obj.twofactorturn));
}
});
},
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question