Hive coding #3

How to get comments of last Posting?

by hive_coding

HTML

<html>

  <head>
    <script src="https://cdn.jsdelivr.net/npm/@hiveio/hive-js/dist/hive.min.js"></script>
    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
  </head>
  <body>

    Username: <input id="username" value="freegifts"><button id="btnShowAccount">Get Postingn</button>
    <h2>Ausgabe/Output:</h2>
    <div id="log"></div>

    <script>
      $("#btnShowAccount").click(function() {

        let username = $("#username").val();
        hive.api.getDiscussionsByAuthorBeforeDate(username,null,null,1, function(err, result) {

				if(result.length>0)

                hive.api.getContentReplies(username, result[0].permlink, function(err, result) {

                  for(j=0;j<result.length;j++){
                      let r=result[j];
                      $("#log").append("<div>"+r.author+"</div>");          
                    }

                  console.log(err, result);
                });
           

        });
      });
    </script>
  </body>
</html>