0

I am using discord API to get all information about users and their guilds. But when I filter all information I need and try to show it on frond end of my aplication. It show as: Object, object , I was trying to do this for a long time, and it confuses me a lot. Please help. Thank you

I am using express.

HTML Code:


<head>
   <meta charset="UTF-8">
</head>
<style>
   #body {
      text-align: center;
      margin-top: 100px;

   }

   #h1info {
      color: black;
      font-family: Arial;
   }

   #guild {
      color: black;
      font-family: Arial;
   }

   #b1 {

      background-color: white;
      height: 80px;
      border: 2px solid black;
      border-radius: 30px;
      width: 70%;
      text-align: left;
      padding: 15px 15px;
      margin-top: 10px;
   }
</style>

<body id="body">
   <img src="https://cdn.discordapp.com/avatars/<%=id%>/<%=avatar%>">
   <H1 id="h1info">Username: <%=username%><br>ID: <%=id%>
   </H1>

   <br><br>

   <script>


      var guildsLength = '<%=guildsLength%>';
      var guilds = '<%=guilds%>';




      document.addEventListener('DOMContentLoaded', function () {

         for (var i = 0; i < guildsLength; i++) {


            var button = document.createElement('button');
            button.type = 'button';
            button.innerHTML = guilds;
            button.className = 'btn-styled';
            button.id = 'b1'

            button.onclick = function () {
               // …
            };

            document.body.appendChild(button);

         }

      }, false);
   </script>


</body>


</html>

My array looks like this:

[
  { name: ' • Ghost Community', id: '920369960419721267' },
  { name: 'KAROVICH', id: '951578230496850021' },
  { name: 'BOTTESTER V2', id: '977826403221385277' }
]

veedoni
  • 37
  • 4

0 Answers0