blob: 651ef3ea1a3e639f4ba387bc94eebcd172cb3ee2 (
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
|
<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}`)
});
});
});
</script>
|