siang agan2 sekalian,
perkenankan ane untuk bertanya dimari.
jadi gini gan, ane ada tampilan seperti ini gan:
yang mau ane tanyain ke agan-agan sekalian, bagaimana caranya supaya setiap ane tambah records/baris pada list tersebut lalu ane isi kode barang dan jumlah dengan ane memilih "Combobox" keluar atau masuk maka records/baris tersebut tersimpan/ter'insert pada database gan.
berikut script ane gan:
Spoiler for script :
HTML Code:
<!-- Table -->
<table>
<thead>
<tr>
<th class="center" width="5" > No.</th>
<th class="center" width="250" > Kode Barang</th>
<th class="center" > Nama Barang</th>
<th class="center" width="150" > Jumlah</th>
<th class="center" width="50" > Keluar/Masuk</th>
<th class="center" width="250" > Catatan</th>
<th class="center" width="90" > Action</th>
</tr>
</thead>
<tbody id="container" >
</tbody>
</table>
<input type="button" name="add_btn" value="Add" id="add_btn" >
[removed]
$(document).ready(function() {
var count = 0;
$("#add_btn").click(function(){
count += 1;
$('#container').append(
'<tr id="records" > '
+'<td> <input style=" border:none;width:5px;" id="no'+count+'" name="no'+count+'" type="text" value="'+count+'" > <input id="kode'+count+'" name="kode'+count+'" type="hidden" value="<?php echo $id_kode;?>" > </td> '
+'<td> <input style=" border:none;width:233px;" id="kdbrg'+count+'" name="kdbrg'+count+'" type="text" value="" > </td> '
+'<td> <input style=" border:none;width:233px;" id="nmbrg'+count+'" name="nmbrg'+count+'" type="text" > </td> '
+'<td> <input style=" border:none;width:133px;" id="jumlah'+count+'" style="width:35px;" name="jumlah'+count+'" type="text" > </td> '
+'<td> <select id="status'+count+'" name="status'+count+'" style=" border:none;width:93px;" > <option> -</option> <option value="1" > Keluar</option> <option value="2" > Masuk</option> </select> </td> '
+'<td> <input style=" border:none" id="cctn'+count+'" style="width:35px;" name="cctn'+count+'" type="text" > </td> '
+'<td class="center" > <a id="remove_item" href="#" > X</a> '
+'<input id="rows_' + count + '" name="rows[]" value="'+ count +'" type="hidden" > '
+'</td> '
+'</tr> '
);
});
// $("#remove_item").live('click', function (ev) {
// if (ev.type == 'click') {
// $(this).parents("#records").fadeOut();
// $(this).parents("#records").remove();
// }
// });
// $('select').live('change',function () {
$('select').on('change',function () {
// var statusVal = $(this).val();
var statusVal = document.faddjurnal.status;
alert(statusVal);
$.ajax({
type: "POST",
url: "<?php echo $application_path; ?> /savestatus.php",
data: {statusType : statusVal },
success: function(msg) {
$('#autosavenotify').text(msg);
}
})
});
});
[removed]
Sebelum dan sesudahnya ane ucapin terima kasih untuk agan-agan sekalian.