title: AJAX TABLE : how to call a function by onclick in button on the table ? json
body: <p>I need to call the function by clicking on the button passing the id of that position as a parameter, but I didn't get this ways, how do I do it using this syntax?</p>
  
  <pre><code>    function populateTable(data){
      var table = document.getElementById('table-sector')
      for (var i = 0; i &lt; data.length; i++) { 
        var row = ` &lt;tr&gt;&lt;td&gt;${data[i].nome}&lt;/td&gt;
                        &lt;td&gt;${data[i].sigla}&lt;/td&gt;
                        &lt;td&gt;${data[i].ramal}&lt;/td&gt;
                        &lt;td&gt;${data[i].email}&lt;/td&gt;
                        &lt;td&gt;&lt;button onclick="populateInfo(${data[i]._id}) "type="button" class="btn btn-primary" " data-toggle="modal"
                        data-target="#info"&gt;+&lt;/button&gt;&lt;/td&gt;
                        &lt;/td&gt;
                    &lt;/tr&gt;`
  
  
  
        table.innerHTML+= row
  
      }
    }
  
  function populateInfo(data){
  
         console.log(data)
  
    }
  </code></pre>