Created
July 6, 2020 02:33
-
-
Save blogcacanid/9f7edf8b44e0eb1559a5069b6c2af4ed to your computer and use it in GitHub Desktop.
pegawai.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class='container py-4'> | |
<div class="row"> | |
<div class="col-sm-5"> | |
<div class="card"> | |
<div class="card-header"><i class="fa fa-users"></i> Pegawai</div> | |
<div class="card-body" style="font-style: Calibri;font-size:12px"> | |
<div class="form-group"> | |
<label for="nip">NIP:</label> | |
<input type="text" class="form-control" name="nip" id="nip" placeholder="Enter NIP" /> | |
</div> | |
<div class="form-group"> | |
<label for="nama_pegawai">Nama Pegawai:</label> | |
<input type="text" class="form-control" name="nama_pegawai" id="nama_pegawai" readonly="true" /> | |
</div> | |
<div class="form-group"> | |
<label for="alamat">Alamat:</label> | |
<input type="text" class="form-control" name="alamat" id="alamat" readonly="true" /> | |
</div> | |
<div> | |
<div> | |
<div> | |
</div> | |
</div> | |
<script type="text/javascript"> | |
var delay = (function () { | |
var timer = 0; | |
return function (callback, ms) { | |
clearTimeout(timer); | |
timer = setTimeout(callback, ms); | |
}; | |
})(); | |
$("#nip").keyup(function () { | |
delay(function () { | |
var token = "<?= csrf_hash() ?>"; | |
var nip = $("#nip").val(); | |
$.ajax({ | |
url: '<?=base_url()?>/Pegawai/find_NIP', | |
method:'GET', | |
data:"nip="+nip , | |
}).success(function (data) { | |
var json = data, | |
obj = JSON.parse(json); | |
$('#nama_pegawai').val(obj.nama_pegawai); | |
$('#alamat').val(obj.alamat); | |
}); | |
}, 1000); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment