function getItemStock()
{
    // $("#serial").change(function(){
        var item_serial=document.getElementById("serial").value;  
        // alert(item_serial);
        $.ajax({
                    
                    url: '/getitemStockBySerial',
                   
                    type: "GET",
                    
                    data:{'serial': item_serial},
                    contentType: 'application/json; charset=utf-8',
                    success: function (data) {

                   console.log(data);
                        var table = $('#example').DataTable();
                        table.row.add([
                                   
                            data['ref_code'],
                            data['item_quantity'],
                            data['item_code'],
                            '<td>  <input style="width: 132px;" step="any" type="number" id="SelectedLength" name="length[]" value="0" min="0"  max="'+data['item_length']+'"></td>',
                           
                            data['item_serial'],
                            ' <td><input type="hidden" value=" '+data['item_stock_id']+'" name="iditem_stock[]" ></td>'

                        ]).draw(false);
                        document.getElementById("serial").value = "";
                    }



});

}