I'm using the JavaScript SDK with I'm using parse.com.
The below code is meant to select the user thats currently logged in, then retrieve their "username" from the "User" class and show it in the console log.
Parse.initialize("XXXX", "XXXX"); var currentUser = Parse.User.current(); var query = new Parse.Query(Parse.User); query.equalTo(currentUser); query.find({ success: function(theuser) { console.log(username); } });
UPDATE, BASED ON THE ANSWER BELOW I TRIED
var currentUser = Parse.User.current();
var user = currentUser.get("username");
var user = currentUser.get("gender");
console.log(user);
console.log(gender);
but now get Uncaught ReferenceError: gender is not defined ?
At the moment I'm getting the following error.
POST https://api.parse.com/1/classes/_User 400 (Bad Request) parse-1.2.17.min.js:1 t._ajax parse-1.2.17.min.js:1 t._request parse-1.2.17.min.js:1 t.Query.find parse-1.2.17.min.js:3 (anonymous function)
This seems to say it cannot find the User class, but you can see from the screen shot this does exist. Can anyone help me with what the issue is here?