Voici le JavaScript:
<script type="text/javascript">
$(document).ready(function()
{
$(".EditQTY").click(function()
{
var ID=$(this).attr('id');
$("#show_"+ID).hide();
$("#hide_"+ID).show();
}).change(function()
{
var ID=$(this).attr('id');
var show=$("#hide_"+ID).val();
var dataString = 'id='+ ID +'&qty='+show;
$("#status_"+ID).html('<img src="img/loading.gif" />');
if(show.length>0)
{
$.ajax({
type: "POST",
url: "inventory_qty_ajax.php",
data: dataString,
cache: false,
success: function(html)
{
$("#show_"+ID).html(show);
}
});
}
else
{
alert('Enter something.');
}
});
$(".editbox").mouseup(function()
{
return false
});
$(document).mouseup(function()
{
$(".editbox").hide();
$(".text").show();
});
});
</script>
Et voici la donnée à rafraichir:
<td id="status_<?php echo $id; ?>"><?php if ($status == 'ordered') { echo '<label <label id="result" class="label label-warning">Ordered</label>'; } elseif ($qty <= $qtyalert) { echo '<label <label id="result" class="label label-danger">To order</label>'; } elseif ($qty >= $qtyalert) { echo '<label <label id="result" class="label label-success">In stock</label>'; } ?></td>
Merci, Agent5acad27