View difference between Paste ID: 2ebi9AjL and LU5hnbuL
SHOW: | | - or go back to the newest paste.
1
<script type="text/javascript">
2
    $(document).on('change', '#cnt_code', function() {
3
        $.ajax({
4
            url: '<?php echo base_url().$directory; ?>/get_detail_contact/',
5
            type: 'get',
6
            data: {"cnt_code" : $('#cnt_code').val()}
7
        }).done(function (data) {
8
	console.log(data);
9
	off(); //bak test di console ape pesu?
10
            // ini nanti ngisi ke masing2 form field
11
            var obj = jQuery.parseJSON(data); // obj ini hasilnya
12
            alert(obj.cnt_first_name); // ini nggak mau muncul fieldnya, hasilnya malah undefined
13
        }).fail(function() {
14
            alert('fail');
15
        });
16
    });
17
</script>