Parse & JS: Retrieving comment using the parentId

This entry is part 23 of 25 in the series Parse & Javascript

From the parent, we could retrieve the objectId.

Since we have this objectId in each comment object, we can retrieve the relevant comment of the Post.

<!doctype html>
        <title>My Parse App</title>
    <script type='text/javascript' src=''></script>
    <script type='text/javascript' src=''></script>
    <div style='display:none' class='error'>
                <h1>Movie not found</h1>          
    <div style='display:none' class='success'>
                <h1>Movie Found</h1>            
    Parse.initialize('kYqz3wRHRa0GDX7viRIVXKDVNIaI0q7Fw6Ms3pv2', 'yPjRYQmwZC2MthUPrer1mU9dDpr84xVQjmEtT7fS');
    var Comment = Parse.Object.extend('Comment');
    var comment = new Comment();

    var query = new Parse.Query(Comment);

    query.equalTo('parentId', 'NBQjz5Rr2y');

                success: function (comment) {
                    var content = comment[0].get('content');

Try The Code
Series Navigation<< Parse & JS: Relational data
Parse & JS: Return only one object >>

Leave a comment

Leave a Reply