How can I select in javascript ? I use parse.com as a database, this is my code, but it doesn't work
app.get('/students', function (req, res) {
var students = Parse.Object.extend("students");
var query = new Parse.Query(students);
query.find({
success: function (results) {
for (var i = 0; i < results.length; i++) {
var students = results[i];
alert(students.get('Name')+ ' - ' + students.get('Lname')+ ' - ' + students.get('class_id'));
res.render('students/index', { students: students});
}
}
})
And the logs error:
I2014-07-18T15:47:16.779Z] Error: cannot call http.ServerResponse.end() multiple times
at end (http.js:428:13)
at renderErrorResponse (connect_proto.js:155:15)
at next (connect_proto.js:187:9)
at fn (express_response.js:758:25)
at View.exports.renderFile [as engine] (jade.js:1149:5)
at View.render (express_view.js:77:8)
at Function.app.render (express_application.js:516:10)
at res.render (express_response.js:763:7)
at query.find.success (routes/students.js:28:29)
at Parse.js:2:5786
Could you help me please ?