jeudi 1 janvier 2015

Parse retrieve a particular user information and display it (Javascript)


I would like to pull all information of a particular user stored in parse and display it on my website. What I mean by particular, is that user would enter the objectID of a user in a textfield, and the value of that textfield would be use to pull all information of that user from the parse database.



<script type="text/javascript">
$(document).ready(function() {

// ***************************************************
// NOTE: Replace the following your own keys
// ***************************************************
var userID = document.getElementById("txtUserID").value;

Parse.initialize("ID", "ID");


var userInfo = new Parse.Object("User");
var query = new Parse.Query(userInfo);


query.include("Addresss");
query.include("name");

query.equalTo("objectId", userID);
query.find({
success: function(results) {
res.send(results)

},
error: function(error) {
console.error("Error: " + error.code + " " + error.message);
}
});
});
</script>
</head>
<body>


<input name="txtUserIDName" id="txtUserID" type="text" value="test">


</body>
</html>


My question now that the user has entered the objectid, and that parse has retrieve it (not sure if my code to retrieve is proper), how to display information about that particular user like address on screen to the user.





Aucun commentaire:

Enregistrer un commentaire