Advertisement
Guest User

tata

a guest
Aug 21st, 2019
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var getUrl      = window.location;
  2. var url         = getUrl .protocol + "//" + getUrl.host + "/" + getUrl.pathname.split('/')[0];
  3.  
  4. function swalAlert(type,title,text,footer) {
  5.     swal({
  6.           icon      : type,
  7.           title     : title,
  8.           text      : text,
  9.           footer    : footer,
  10.           timer     : null
  11.     }).then((value) => {
  12.         tabelData();
  13.         //window.location.assign(url+"employees");
  14.       });
  15. }
  16.  
  17. function simpan() {
  18.     $.ajax({
  19.         data: $('#employeForm').serialize(),
  20.         url: url+"employees/store",
  21.         type: "POST",
  22.         dataType: 'json',
  23.         success: function (response) {
  24.             swalAlert('success','Simpan Data','Data Berhasil Disimpan','Terima Kasih');
  25.             $("#employeForm").trigger('reset');
  26.  
  27.         },
  28.         error: function (response) {
  29.             swalAlert('error','Simpan Data','Terjadi Kesalahan','Cek Isian Data Anda');
  30.             $("#employeForm").trigger('reset');
  31.         }
  32.     });
  33. }
  34.  
  35. function showTambah() {
  36.     $("#tambahEmploye").modal("show");
  37.     $("#titleEdit").addClass("fade");
  38.     $("#Update").addClass("fade");
  39.     $("#titleEntry").removeClass("fade");
  40.     $("#save").removeClass("fade");
  41.     $("#PasswordArea").removeClass("fade");
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement