Advertisement
Guest User

bayar_ajax.js

a guest
Mar 27th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // JavaScript Document
  2. $(document).ready(function(){
  3.     $(function(){
  4.         $('button').hover(
  5.             function() { $(this).addClass('ui-state-hover'); },
  6.             function() { $(this).removeClass('ui-state-hover'); }
  7.         );
  8.     });
  9.     $("#no").keyup(function(e){
  10.         var isi = $(e.target).val();
  11.         $(e.target).val(isi.toUpperCase());
  12.     });
  13.    
  14.     $('#tabs').tabs();
  15.    
  16.     $("#tgl").datepicker({
  17.             dateFormat:"dd-mm-yy"        
  18.     });
  19.     $("#tgl1").datepicker({
  20.             dateFormat:"dd-mm-yy"        
  21.     });
  22.     $("#tgl2").datepicker({
  23.             dateFormat:"dd-mm-yy"        
  24.     });
  25.    
  26.     $("#jml").keypress(function (data)  {
  27.         if(data.which!=8 && data.which!=0 && (data.which<48 || data.which>57)){
  28.               return false;
  29.         }  
  30.     });
  31.     $("#bunga").keypress(function (data)  {
  32.         if(data.which!=8 && data.which!=0 && (data.which<48 || data.which>57)){
  33.               return false;
  34.         }  
  35.     });
  36.    
  37.     $("#form_isian").hide();
  38.    
  39.     $("#tampil_data1").load('modul/bayar/tampil_data1.php');
  40.    
  41.    
  42.     $("#tambah").click(function(){
  43.         $("#form_isian").show();
  44.         $("#menu-tombol1").hide();
  45.         $("#no").focus();
  46.         var no = $("#no").val();
  47.         $("#tampil_data1").load('modul/bayar/tampil_data_cicilan.php?cari='+no);
  48.         $("#info").val('');
  49.     })
  50.    
  51.    
  52.     $("#tutup").click(function(){
  53.         $(".input").val('');
  54.         $("#form_isian").hide();
  55.         $("#menu-tombol1").show();
  56.         $("#tampil_data1").load('modul/bayar/tampil_data1.php');
  57.     })
  58.    
  59.     function cariAnggota(e){
  60.         var cari = e;
  61.         $.ajax({
  62.             type    : "POST",
  63.             url     : "modul/bayar/cari_anggota.php",
  64.             data    : "cari="+cari,
  65.             success : function(data){
  66.                 $("#info_anggota").html(data);
  67.             }
  68.         });
  69.     }
  70.    
  71.    
  72.     $("#cari_no").click(function(){
  73.         var cari = $("#no").val();
  74.         cariPinjaman(cari);
  75.     })
  76.    
  77.     function cariPinjaman(e){
  78.         var cari = e;
  79.         $.ajax({
  80.             type    : "POST",
  81.             url     : "modul/bayar/cari.php",
  82.             data    : "cari="+cari,
  83.             dataType: "json",
  84.             success : function(data){
  85.                 $("#nomor").val(data.nomor);
  86.                 $("#tgl").val(data.tgl);
  87.                 $("#lama").val(data.lama);
  88.                 $("#jml").val(data.jml);
  89.                 $("#bunga").val(data.bunga);
  90.                 var nomor = data.nomor;
  91.                 cariAnggota(nomor);
  92.                 $("#tampil_data1").load('modul/bayar/tampil_data_cicilan.php?cari='+cari);
  93.             }
  94.         });
  95.     }
  96.    
  97.     $("#cari2").click(function(){
  98.         var tgl1 = $("#tgl1").val();
  99.         var tgl2 = $("#tgl2").val();
  100.        
  101.         if(tgl1.length==0){
  102.             alert('Maaf, Tanggal tidak boleh kosong');
  103.             $("#tgl1").focus();
  104.             return false();
  105.         }
  106.         if(tgl2.length==0){
  107.             alert('Maaf, Tanggal tidak boleh kosong');
  108.             $("#tgl2").focus();
  109.             return false();
  110.         }
  111.        
  112.         cariData2(tgl1,tgl2);
  113.     });
  114.    
  115.     function cariData2(e1,e2){
  116.         var tgl1 = e1;
  117.         var tgl2 = e2;
  118.        
  119.         $.ajax({
  120.             type    : "POST",
  121.             url     : "modul/bayar/tampil_data2.php",
  122.             data    : "tgl1="+tgl1+"&tgl2="+tgl2,
  123.             success : function(data){
  124.                 $("#tampil_data2").html(data);
  125.             }
  126.         });
  127.     }
  128.     $("#cari3").click(function(){
  129.         var cari = $("#txt_cari").val();
  130.         cariData3(cari);
  131.     });
  132.    
  133.     function cariData3(e){
  134.         var cari = e;
  135.         $.ajax({
  136.             type    : "POST",
  137.             url     : "modul/bayar/tampil_data3.php",
  138.             data    : "cari="+cari,
  139.             success : function(data){
  140.                 $("#tampil_data3").html(data);
  141.             }
  142.         });
  143.     }
  144. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement