我正在制作简单的 Todo 应用程序。我想从 Parse.com 获取数据。表格如下:
我试图获取数据,但这不起作用:
Parse.initialize("xxxxxx", "xxxxx");
var Task = Parse.Object.extend({
...
});
var Tasks = Parse.Collection.extend({
...
});
var TaskView = Parse.View.extend({
...
});
var TasksView = Parse.View.extend({
...
});
var AddTaskView = Parse.View.extend({
...
});
tasks = new Tasks;
tasks.query = new Parse.Query(Task);
tasks.fetch();
console.log(tasks.toJSON()); // I want to retrieve tasks but returns '[]'
addTaskView = new AddTaskView({
collection: tasks
});
tasksView = new TasksView({
collection: tasks
});
$('#tasks').html(tasksView.render().el);
整个页面在这里(JSbin):http: //jsbin.com/iDociSu/2/edit
谢谢你的好意。