how can i update current object in parse.com with javascript?

javascript, parse-platform

Solution

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);
  }
});

Problem

I want to update object i already have in parse.com with javascript; what i did is i retirevied the object first with query but i dont know how to update it. here is the code i use, whats wrong on it? ``` var GameScore = Parse.Object.extend("Driver"); var query = new Parse.Query(GameScore); query.equalTo("DriverID", "9"); query.find({ success: function(results) { alert("Successfully retrieved " + results.length + "DName"); results.set("DName", "aaaa"); results.save(); }, error: function(error) { alert("Error: " + error.code + " " + error.message); } }); ```

Original source