Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I am brand new to parse and have a very basic problem.

How can I update data in the DB using a function? It seems I am to stupid to get this to work :-) I tried many different scenarios but it will always create a new row in the DB.

My plan is to create the parse object and use it inside of various functions and save it back to the cloud at a later stage – or in this update function.

Thanks for your help.

My Code:

I embedded jquery and the parse-1.2.13.min.js inside the head tag and used a simple

a href link to call the updateData function.



        Parse.initialize("xxx", "xxx");

        var GameScore = Parse.Object.extend("GameScore");
        var gameScore = new GameScore();

        var query = new Parse.Query(GameScore);
        query.equalTo("username", "Carlo");
        query.first({
            success: function(gameScore) {
                 console.log("ID: "+gameScore.id);
                 console.log("score: "+gameScore.get("score"));
            },
            error: function(object, error) {
                console.log("The object was not retrieved successfully: "+error);
            }
        });

        function updateData(newScore){
            console.log("updateData called");
            gameScore.set("score",newScore);
            gameScore.save();
        }

        var newScore = "999";


share|improve this question
    
You're not setting the value of gameScore to anything other than new GameScore()... –  RobH Dec 12 '13 at 10:26
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.