$(document).ready(function () { tampil_data_userapproval(); $('#table_userapproval').DataTable(); function tampil_data_userapproval() { $.ajax({ type: 'ajax', url: window.location.origin + '/mbkm/admin/get_all_userapproval/', async: false, dataType: 'json', success: function (data) { // console.log(data); var html = ''; var i; var base_url = window.location.origin; for (i = 0; i < data.length; i++) { html += '' + '' + (i + 1) + '' + '' + data[i].username + '' + '' + data[i].asaluniv + '' + '' + data[i].kotauniv + '' + '' + data[i].notelpuniv + '' + '' + data[i].notelpuser + '' + '' + data[i].create_at + '' + '' + data[i].status + '' + '' + '' + '' + ''; } $('#show_data').html(html); } }); } //Fungsi Tampil Modal edit $('#show_data').on('click', '.tombol-edit-approval', function () { var id = $(this).attr('data'); // $('#modal-edit').modal('show'); $.ajax({ type: 'GET', url: window.location.origin + '/mbkm/admin/get_userapproval/', dataType: 'json', data: { id: id }, success: function (data) { $.each(data, function() { var base_url = window.location.origin; $('#modal-detail').modal('show'); $('.form-edit-approval').attr('action', base_url + '/mbkm/admin/edit_userapproval/' + data.id); $('#id').val(data.id); $('#namadepan').val(data.namadepan); $('#namabelakang').val(data.namabelakang); $('#email').val(data.email); $('#username').val(data.username); $('#asaluniv').val(data.asaluniv); $('#status').val(data.status); }); } }); return false; }); });