Advertisement
Guest User

Untitled

a guest
Mar 30th, 2015
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement