0
Colleagues,
How do I get the value of a onclick and direct to another page. See below:
$('.value-plus').on('click', function(){
var lista = $('.invert > span');
$.each(lista, function(index,item){
valor = $(item).text();
trocar = valor.replace(",",".");
e.preventDefault();
var objeto = new Object();
objeto.valor = trocar.toFixed(2);
var dados= JSON.stringify(objeto);
$.ajax({
type: "GET",
dataType: 'json',
data: dados,
url: "atualizar-carrinho.php",
success: function(resposta){
if (resposta) {
alert("Sucesso!");
} else {
alert("Erro");
}
}
});
});
});
In the update cart.php I’m taking it this way:
<?php
$conexao = (conexao ao banco de dados);
$novoValor = $_GET['valor'];
mysqli_query($conexao,"INSERT INTO teste VALUES(null,'".$novoValor."')");
Serialize the list and send it on date! You can use as an example this answer here
– Marconi
what you are hoping to receive in the
atualizar-carrinho.php
? values separated by comma? objects?– andrepaulo
Hello Andrepaulo. The objects. I need to take the variable change.
– user24136
Hello Marconi. I made a change to my post based on the link you sent me, but it is not passing the value...
– user24136