Greetings When I click the button in my project the following TypeError error is displayed: $ (...). TableToJSON is not a function, I am using the tableToJSON plugin
Code:
$('document').ready(function(){
$('#TermVenda').click(function(){
var table =$('#products-table').tableToJSON();
console.log(table);
document.write(JSON.stringify(table));
alert(JSON.stringify(table));
});
});
HTML table: <!DOCTYPE html>
<html>
<head>
<title>Pagina do Cliente</title>
<script type="text/javascript" src="js/jquery-1.11.3.min.js"></script>
<script type="text/javascript" src="js/jquery.tabletojson.min.js"></script>
</head>
<body>
<table id="products-table" class="table table-hover table-bordered"> <thead>
<tr>
<th>Produto</th>
<th>Preço </th>
<th>Qtd</th>
<th>Valor</th>
<th>Ações</th>
</tr>
</thead>
<tbody>
<tr>
<td>Banana</td>
<td>20</td>
<td>5</td>
<td>100</td>
<td>x</td>
</tr>
<tr>
<td>Alho</td>
<td>20</td>
<td>5</td>
<td>100</td>
<td>x</td>
</tr>
</tbody>
</table>
<button id="TermVenda">Converter</button>
</body>
</html>