I have this blade file with a simple html table:
<div class="table-responsive datatable-custom">
<table class="table table-borderless table-thead-bordered table-nowrap table-text-center table-align-middle card-table">
<thead class="thead-light">
<th>TOTALS</th>
</thead>
<tbody id="table-body">
</tbody>
</table>
</div>
I'm calling my api by axios, is possible to use a laravel or do they only work for laravel?
axios.get('/api/contacts')
.then(function (response) {
let json = response.data;
let tableText = "";
json.leads.forEach((row) => {
tableText += "<tr>";
tableText += "<td><x-js.modal totals="here my javascript data"></x-js.modal></td>"; <!-- here my laravel x-component
tableText += "</tr>";
});
document.getElementById('table-body').innerHTML = tableText;
})
.catch(function (error) {
console.log(error);
})
.finally(function () {
});