openclassify/addons/default/visiosoft/profile-module/resources/assets/js/education.js
2020-12-15 15:07:34 +03:00

45 lines
1.5 KiB
JavaScript

$(() => {
$.ajax({
url: '/ajax/getEducation',
success: ((res)=>{
$.each(res['education-part'], function (key, value) {
var selected = ""
if (res.user.education_part == value.id){ selected = 'selected'; }
$('#education_part').append('<option '+ selected +' value="'+ value.id +'">' + value.name + '</option>')
})
})
})
$('#education').on('change', () => {
$.ajax({
url: '/ajax/setEducation',
data: {
info: 'education',
education: $('#education').val()
},beforeSend: function (){
$('#education_part').html('');
},success: function (response) {
$('#education_part').html('<option>'+ choose_an_option +'</option>')
$.each(response.data, function (key, value) {
$('#education_part').append(
'<option value="'+ value.id +'">'+ value.name +'</option>'
)
})
}
});
})
$('#education_part').on('change', () => {
$.ajax({
url: '/ajax/setEducation',
data: {
info: 'education_part',
education: $('#education_part').val()
}, beforeSend: function (){
$('#education_part_option').html('');
}, success: function (response) {
}
})
})
})