0๐
is there a better way to make the code work better because currently i
have to click the the select box twice for it to pull new data. ?
why not after you mounted(ready) or insert a new data(new list) and just pull the new records there and insert it to your this.list = tasks;
new Vue({
data : {
list = []
},
ready : function(){
this.initialize();
},
methods : {
initialize : function(){
let self = this;
$.get('url',function(response)
{
self.list = response.task
}
},
createNewTask: function(){
let self = this;
$.post('url',{data},function(response)
{
self.list = response.task
}
}
}
})
you should not put your ajax pull from your select box as it will consume a time to pull new data from server and put it to your list array
.
Source:stackexchange.com