Saudações Ao clicar no Botão no meu projecto é apresentado o seguinte erro TypeError: $(...).tableToJSON is not a function, estou a usar o plugin tableToJSON
Código:
$('document').ready(function(){
$('#TermVenda').click(function(){
var table =$('#products-table').tableToJSON();
console.log(table);
document.write(JSON.stringify(table));
alert(JSON.stringify(table));
});
});
Tabela HTML: <!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>