Javascript 为什么我在使用parse.com为数组执行fetchAll时出错?
我有一个与历史对象有一对多关系的对象查询 我的要求是,当用户请求历史时,我需要获取所有历史对象,然后显示它们 这是我的密码:Javascript 为什么我在使用parse.com为数组执行fetchAll时出错?,javascript,parse-platform,Javascript,Parse Platform,我有一个与历史对象有一对多关系的对象查询 我的要求是,当用户请求历史时,我需要获取所有历史对象,然后显示它们 这是我的密码: function fetchAndShowHistory(object, objectType) { var historyObjects = object.get("history"); Parse.Object.fetchAll(historyObjects, { success : function(historyObjects) { /
function fetchAndShowHistory(object, objectType) {
var historyObjects = object.get("history");
Parse.Object.fetchAll(historyObjects, {
success : function(historyObjects) {
//code to show history objects
},
error : function(error) {
alert("Could not fetch history, " + error.message);
},
});
}
现在使用当前代码,我得到了以下错误:
未捕获类型错误:对象函数(a,d){if(c.isString(a))返回
b、 Object.create.apply(this,arguments);a=a | |{},d&&d.parse&(a=this.parse(a));var
e=b.getValue(这是“默认值”);if(e&&(a=c.extend({},e,a)),d&&d.collection&&(this.collection=d.collect……l'
请注意,这甚至不会调用服务器,但会在javascript代码中消失。知道这里出了什么问题吗?代码的最后第二行有一个“,”。这是一个语法错误,会导致代码失败 这是正确的代码->
function fetchAndShowHistory(object, objectType) {
var historyObjects = object.get("history");
Parse.Object.fetchAll(historyObjects, {
success : function(historyObjects) {
//code to show history objects
},
error : function(error) {
alert("Could not fetch history, " + error.message);
}
});
您确定historyObjects是object.get(“history”)之后的列表吗?请在其中放置断点或console.log以确定。historyObjects是一个历史对象数组。