Hey guys i am having a small issue with Parse for Javascript at the moment, I have used Parse before but for Android and for some reason found it more easier to understand than using it with Javascript.
My current issue is that I am trying to query the User object in my parse database to see whether or not they are an admin or not by checking to see in the "role" column has an integer of 1 or 2. 1 representing a Admin and 2 representing an ordinary user.
If I can remember correctly querying a User is different from querying a normal object in the database, So I am unsure why this query does not carry out correctly. If i take out the query the function works fine and displays the set message of "welcome" in an alert box but when I add in the query it doesnt seem to carry out the function.
My table in the database looks like this:

My current code is as follows:
$('.form-signin').on('submit', function(e) {
// Prevent Default Submit Event
e.preventDefault();
// Get data from the form and put them into variables
var data = $(this).serializeArray(),
username = data[0].value,
password = data[1].value;
// Call Parse Login function with those variables
Parse.User.logIn(username, password, {
// If the username and password matches
var query = new Parse.Query(Parse.User);
query.equalTo("role", 1); //finding the role number
query.find({
success: function(user) {
alert('Welcome!');
},
// If there is an error
error: function(user, error) {
console.log(error);
}
});
});
});