0

After having manually created a record within an object named "Cards" in parse.com with an objectId of 9e9JAIYSFa, I am attempting to retrieve attributes (attack and defense) of this record by closely following the documentation.

alert("1");
var Cards = Parse.Object.extend("Cards");
alert("2");
var cards = new Cards();
alert("3");
var query = new Parse.Query(cards);
alert("4");
query.get("9e9JAIYSFa", {
    success: function (cards) {
        alert("5");
    },
    error: function (object, error) {
        alert("6")
    }
});
alert("7")

    var attack = cards.get("attack");
    var defense = cards.get("defense");
alert("8");
    alert(attack);
    alert(defense);
alert("9");

This returns the error in chrome:

Uncaught TypeError: Cannot read property 'className' of undefined

which is pointing to line 3 of the parse-1.3.2.min.js file.

A point worth noting is that only alerts 1, 2 and 3 are displayed.

After looking at these questions:

Parse - Uncaught TypeError: Cannot read property 'get' of undefined

Uncaught TypeError: Cannot read property 'get' of undefined - How do I solve this?

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

I tried accessing the objectId manually using this code:

    query.equalTo("objectId", "9e9JAIYSFa");
    query.find({
        success: function (cards) {
            alert("Working");
        },
        error: function (object, error) {
            alert("Not working");
        }
    });

But this also results in the same error.

Any ideas?

2
  • var query = new Parse.Query(cards); shoud be Cards Commented Nov 29, 2014 at 15:20
  • Thank you. If you create an answer with this information then I'll accept it Commented Nov 29, 2014 at 15:26

1 Answer 1

1

The parameters of Parse.Query should be class rather class instance. -- ref. Parse.Query

It should fix the problem by replacing cards from var query = new Parse.Query(cards); to Cards as var query = new Parse.Query(Cards);.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.