How to call one field table and put it in add row dinamis

How to call one field table and put it in add row dinamis

hello dear, i want ask simple question, how can i call one field came from database, I'm new in Jquery, btw i use codeignter how can i do that, i have already searching but still dont get it and dont know how to strat, Will big thanks if any respon, 

Freddy Sidauruk

  1. //var kode is came from table, and i need to put this field in input type id_pembelian, please see bellow
  2. var kode=

  3. var i=$('table tr').length;
  4. $(".addmore").on('click',function(){
  5. html = '<tr>';
  6. html += '<td><input class="case" type="checkbox"/><input type name="id_pembelian" type="hidden" value="kode">
  7.         </td>';
  8. html += '<td><input type="text" data-type="id_barang" name="itemNo[]" id="itemNo_'+i+'" class="form-control autocomplete_txt" autocomplete="off"></td>';
  9. html += '<td><input type="text" data-type="nama_barang" name="itemName[]" id="itemName_'+i+'" class="form-control autocomplete_txt" autocomplete="off" readonly></td>';
  10. html += '<td><input type="text"  name="StockName[]" id="StockName_'+i+'" class="form-control autocomplete_txt" autocomplete="off" readonly></td>';
  11. html += '<td><input type="text" name="price[]" id="price_'+i+'" class="form-control changesNo" autocomplete="off" onkeypress="return IsNumeric(event);" ondrop="return false;" onpaste="return false;"></td>';
  12. html += '<td><input type="text" name="quantity[]" id="quantity_'+i+'" class="form-control changesNo" autocomplete="off" onkeypress="return IsNumeric(event);" ondrop="return false;" onpaste="return false;"></td>';
  13. html += '<td><input type="text" name="total[]" id="total_'+i+'" class="form-control totalLinePrice" autocomplete="off" onkeypress="return IsNumeric(event);" ondrop="return false;" onpaste="return false;" readonly></td>';
  14. html += '</tr>';
  15. $('table').append(html);
  16. i++;
  17. });