Created
October 3, 2015 01:41
-
-
Save fchevitarese/b65229745ae42aa8fa2e to your computer and use it in GitHub Desktop.
test.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
qtd_produtos = 0; | |
$('#inserir').click(function(){ | |
var quant = $('#quant').val() | |
var total = data.preco * quant | |
$('#tabela_pedido').append("<tr>"+ | |
"<td name='id_codigo'" + qtd_produtos + "><b>" + data.codigo + "</b></td>"+ | |
"<td name='id_nome'" + qtd_produtos + ">" + data.nome +" </td>"+ | |
"<td>" + data.descricao +" </td>"+ | |
"<td name='id_quant'" + qtd_produtos + ">" + quant + "</td>"+ | |
"<td>" + data.preco +" </td>"+ | |
"<td class='text-right pr10'>" + total +" </td>"+ | |
"</tr>"); | |
qtd_produtos++; | |
$('#enviar').click(function(){ | |
$.ajax({ | |
type:"POST", | |
data: {'id_nome': data.nome, 'id_codigo': data.codigo, 'id_quant': quant}, | |
url:"/ecommerce/pedidos/", | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment