Script where I send the information and show it
<script>
$(document).ready(function(){
$('.btcar').click(function(e){
e.preventDefault();
var car = $(this).attr("id");
var stock = $('#stock'+car).val();
var stock1 = parseInt(stock);
var prue = $('#prue').attr("value");
var prue1 = parseInt(prue);
var cant = $('#canti'+prue1).val();
var cant1 = parseInt(cant);
alert(cant1);
if(stock1 > 1 && stock1 != cant1 ){
$.ajax({
url:'carrito.php',
method: 'POST',
data:{car:car, prue:prue},
type:JSON,
success:function(deta){
$('#carrito').html(deta);
}
});
} else{
alert ("Exedio el limite");
}
});
$('#carrito').load("carrito.php");
});
</script>
Data I want to receive when I send
It turns out that this input to the I click btcar is generating orders. The point is that those orders have a stock, and that stock I think out of the number of times I click on the btcar that will be stored in the input of class canti obviously if the order is different I generated it in another input the point is that I can take the value of the first input and achievement that does not continue adding when this is the maximum stock but the others that are generated automatically depending on the order that I select does not recognize me always takes the value of First.
<input type="hidden" id="prue" value="<?php echo $i ?>">
<input type="text" class="canti" id="canti<?php echo $i ?>" name="cantidad" min="1" maxlength="<?php echo $shopCart[$i]['stock']; ?>" value="<?php echo $shopCart[$i]['cantidad']; ?>" style="text-alaing: center;">