View difference between Paste ID: Emsv6AfP and 71aRsQM1
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
		dataType: 'json', //define datatype ne coba
8
        }).done(function (data) {
9
	$.each(data, function (index, value) {
10
        	console.log(value);
11
    	});        	
12
	off(); //bak test di console ape pesu?
13
            // ini nanti ngisi ke masing2 form field
14
            var obj = jQuery.parseJSON(data); // obj ini hasilnya
15
            alert(obj.cnt_first_name); // ini nggak mau muncul fieldnya, hasilnya malah undefined
16
        }).fail(function() {
17
            alert('fail');
18
        });
19
    });
20
</script>