Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //fun edit
- function edit(id)
- {
- save_method = 'update';
- $('#form')[0].reset(); // reset form on modals
- $('.form-group').removeClass('has-error'); // clear error class
- $('.help-block').empty(); // clear error string
- $.ajax({
- url : '<?php echo site_url("admin/produk/edit/'+id+'") ?>',
- type: "GET",
- dataType: "JSON",
- success: function(data)
- {
- $('[name="id"]').val(data.id);
- $('[name="nama"]').val(data.nama);
- $('[name="id_kategori_produk"]').val(data.id_kategori_produk);
- $('[name="pelanggan"]').val(data.pelanggan);
- $('[name="umum"]').val(data.umum);
- $('[name="modal"]').val(data.modal);
- $('#modal_form').modal('show'); // show bootstrap modal when complete loaded
- $('.modal-title').text('Edit Produk'); // Set title to Bootstrap modal title
- },
- error: function (jqXHR, textStatus, errorThrown)
- {
- alert('Error get data from ajax');
- }
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement