how can i update current object in parse.com with javascript?
I found the solution, incase someone needs it later
here it is:
var GameScore = Parse.Object.extend("Driver");
var query = new Parse.Query(GameScore);
query.equalTo("DriverID", "9");
query.first({
success: function(object) {
object.set("DName", "aaaa");
object.save();
},
error: function(error) {
alert("Error: " + error.code + " " + error.message);
}
});
The difference between the question and your answer may not be obvious at first- So for everyone who has happened here- Use query.first instead of query.find.
query.find() //don't use this if you are going to try and update an object
returns an array of objects, an array which has no method "set" or "save".
query.first() //use this instead
returns a single backbone style object which has those methods available.