blob: f793619ddb9de17b94c881dff38f81c1e35661b4 (
plain)
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
|
<script>
$(document).ready(function() {
// When form is submited
////////////////////////////////////////////////////////////////////////////
$('form').submit( event => {
event.preventDefault();
// prepare data to POST
var data = {
// identification fields
id: $('input[name=id]').val(),
// data fields
first_name: $('input[name=first_name]').val(),
last_name: $('input[name=last_name]').val(),
father_name: $('input[name=father_name]').val(),
email: $('input[name=email]').val(),
registration_number: $('input[name=registration_number]').val(),
sector: $('select[name=sector]').select2('data')[0].text,
belonging_school: $('input[name=belonging_school]').val(),
position: $('select[name=position]').select2('data')[0].text,
phone: $('input[name=phone]').val(),
};
console.log(data);
var request = '/user/update/properties'; // set action url
// send POST request
$.post(request, data)
.done(function( data ) {
$('.office .content-form').html(`<h4>${data.title}<h4><br>${data.message}`)
});
});
// go-back event
////////////////////////////////////////////////////////////////////////////
$('.btn-back2panel').click( event => {
event.preventDefault();
let confirm_exit = confirm('<?=CONFIRM_EXIT?>');
if (confirm_exit) {
window.location.href = '/panel';
}
});
});
</script>
|