You are viewing a single comment's thread from:

RE: Creating First Steemit Bot

in #steemit7 years ago

I want to add multiple users in tabular form, I have added the first entry in row one but don't know how to add the rest as the script is not fetching. I tried to add two users like this, but didn't work. steem.api.getAccounts(['aamirijaz','money-dreamer'], function(err, response){ //console.log(err, response);

Sort:  

This is one way to do it:

<html>
    <head>
        <script src="https://cdn.steemjs.com/lib/latest/steem.min.js"></script>
        <script>
            steem.api.getAccounts(['aamirijaz','money-dreamer'], function(err, response){
                console.log(err, response);
                for (var i = response.length - 1; i >= 0; i--) {
                    let newAccount = "<div>Hello " + response[i]['name'] + "<br>You have " + response[i]['balance'] + ".<br>Account birthday is " + response[i]['created'] + "</div><hr>";
                    document.getElementById("name").innerHTML += newAccount;
                }
            });
        </script>
    </head>
    <body>
        <div id="name"></div>
    </body>
</html>

I am so grateful to you! Thanks a lot.