The below should query the parse.com backend and return either a matched user based on the text input or no match, no match meaning that their is no user with that name stored in the parse data browser.
The code runs, but seems to have no results or errors showing. I'm trying to work out why and understand how the code would need to change to correct this?
url is here http://kudosoo.com/findfriends.html
<form class="Find Friend">
<div class="error" style="display:none"></div>
<input type="text" id="friendsearch" placeholder="Find Friend" class="input-field" required/>
<button type="submit" onclick = "finduser" >Find</button>
</form>
<!-- Initialize the Parse object-->
<script type="text/javascript">
Parse.initialize("xxxx", "xxxxx");
function finduser() {
var findFriend = $('#friendsearch').val();
var query = new Parse.Query(Parse.User);
query.equalTo("username", findFriend); // find users that match
query.find({
success: function (friend) {
if (findFriend.length) { console.log("Found match")}
},
error: function (error) {
if (findFriend.length === 0) { console.log("No match")}
}
});
};
</script>