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?
cards); shoud beCards