-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathedit this js.js
executable file
·103 lines (87 loc) · 2.2 KB
/
edit this js.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
//BpMasuk
function tampilBpMasuk() {
$.get('<?php echo base_url('BpMasuk/tampil'); ?>', function(data) {
$('#data-BpMasuk').html(data);
refresh();
});
}
var id_BpMasuk;
$(document).on("click", ".konfirmasiHapus-BpMasuk", function() {
id_BpMasuk = $(this).attr("data-id");
})
$(document).on("click", ".hapus-dataBpMasuk", function() {
var id = id_BpMasuk;
$.ajax({
method: "POST",
url: "<?php echo base_url('BpMasuk/delete'); ?>",
data: "id=" +id
})
.done(function(data) {
$('#konfirmasiHapus').modal('hide');
tampilBpMasuk();
$('.msg').html(data);
effect_msg();
})
})
$(document).on("click", ".update-dataBpMasuk", function() {
var id = $(this).attr("data-id");
$.ajax({
method: "POST",
url: "<?php echo base_url('BpMasuk/update'); ?>",
data: "id=" +id
})
.done(function(data) {
$('#tempat-modal').html(data);
$('#update-BpMasuk').modal('show');
})
})
$('#form-tambah-BpMasuk').submit(function(e) {
var data = $(this).serialize();
$.ajax({
method: 'POST',
url: '<?php echo base_url('BpMasuk/prosesTambah'); ?>',
data: data
})
.done(function(data) {
var out = jQuery.parseJSON(data);
tampilBpMasuk();
if (out.status == 'form') {
$('.form-msg').html(out.msg);
effect_msg_form();
} else {
document.getElementById("form-tambah-BpMasuk").reset();
$('#tambah-BpMasuk').modal('hide');
$('.msg').html(out.msg);
effect_msg();
}
})
e.preventDefault();
});
$(document).on('submit', '#form-update-BpMasuk', function(e){
var data = $(this).serialize();
$.ajax({
method: 'POST',
url: '<?php echo base_url('BpMasuk/prosesUpdate'); ?>',
data: data
})
.done(function(data) {
var out = jQuery.parseJSON(data);
tampilBpMasuk();
if (out.status == 'form') {
$('.form-msg').html(out.msg);
effect_msg_form();
} else {
document.getElementById("form-update-BpMasuk").reset();
$('#update-BpMasuk').modal('hide');
$('.msg').html(out.msg);
effect_msg();
}
})
e.preventDefault();
});
$('#tambah-BpMasuk').on('hidden.bs.modal', function () {
$('.form-msg').html('');
})
$('#update-BpMasuk').on('hidden.bs.modal', function () {
$('.form-msg').html('');
})