SeeleyBoothe
SeeleyBoothe

Reputation: 261

Retrieve ID after save with Parse

I am using the Parse javascript api . So I am new to using parse. I have createda new class in the data browser and have information saving to it.

What I would like to do is do the save but get the id that Parse automatically creates. Is there a way after a save to return a column from the data?

var TestData = Parse.Object.extend("TestData");
        var myObj = new TestData();
        myObj.save({hs_user: frm_hs_user}, {
            success: function(response){
                alert("did it");
            },
            error: function(error){
                alert(error.message);   
            }
        });

Upvotes: 2

Views: 2172

Answers (1)

Thomas Mannion
Thomas Mannion

Reputation: 406

something like this should work

var query = new Parse.Query(TestData);
query.equalTo("objectId"); 
query.find({
    success: function (results) {
        alert(results)
    }

Here is a better example of what i ment

EDIT: Example with object.id

Upvotes: 1

Related Questions