1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| <table>
<? while ($row = mysqli_fetch_assoc($result)) { ?>
<tr>
<td><?php echo $row['model_oem']; ?></td>
<td><?php echo "WV-" . $row['model_horizontal']; ?></td>
<td><?php echo $row['quantity']; ?></td>
<td><?php echo "<input type=\"text\" id=" . $row['model_oem'] . " name=\"product_qts\" value=\"0\">"; ?></td>
<td><?php echo "<input type=\"hidden\" id=" . $row['product_id'] . " name=\"product_id\" value=". $row['product_id'] . ">"; ?></td>
<script>
$(document).ready(function(){
$("#<?php echo $row['model_oem']?>").on('change', function postinput(){
var product_qts = $('#<?php echo $row['model_oem']?>');
var product_id = $('<?php echo $row['product_id']?>');
$.ajax({
url: 'editqts.php',
data: { product_id: <?php echo $row['product_id']?>, product_qts: product_qts },
type: 'post'
}).done(function(responseData) {
console.log('Done: ', responseData);
}).fail(function() {
console.log('Failed');
});
});
});
</script>
</tr>
<?php } ?>
</table> |
Partager