我有一个$ .ajax()函数正常工作并返回一个结果,我想我做了一切需要的数据绑定进展顺利。
页上基本上加载从$。阿贾克斯()追加到表中的数据,但问题是,数据不附加像它应该。我错过了什么吗?
HTML:
JAVASCRIPT:
//VARIABLES
var url = "http://mobisteinlp.com/redirect/redirect";
agr = 0;
//VUE.JS REDIRECT VIEW MODEL
var redirect = new Vue({
el: '#redirect',
data: {
agr1: []
},
mounted() {
this.getAll(); //DISPLAY TABLE ON PAGE LOAD
},
methods: {
//
getAll: function() {
var self = this;
console.log('teste');
$.ajax({
url: url + "/getAll",
type: "POST",
dataType: "json",
success: function(response) {
console.log(response); //
self.agr1 = response;
console.log(self.agr1);
console.log('success!');
},
error: function() {
console.log('error');
} //end error function
}); //end $.ajax() request
}, //end getAll function
} //end methods
}) //end vue.js instance
2017-05-25
Timmy
+0
'但问题是数据没有像它应该添加的那样作为问题描述是不够的。请提供期望的结果和您得到的结果。 –
+0
该表在页面加载时显示为空,当您(重新)加载时应该填充它。 –
+0
你能告诉你得到了什么样的回答,它是一个数组,对象还是对象数组? –