This commit is contained in:
2023-10-22 14:35:23 +03:00
parent adee3383ce
commit 5471696d62
2 changed files with 59 additions and 40 deletions

View File

@@ -244,26 +244,43 @@ async function attachFilemeassge (el,id_ticket=null,sender=null,receiver=null,ch
}
function change_profile_confirm (el){
event.preventDefault()
let form = el.form
let changed_elements = {}
for (let i = 0;i < form.length;i++){
let cur_el = form[i]
if (cur_el.localName !== 'button'){
let new_val = cur_el.value
let dataset = cur_el.dataset
let old_val = ''
if (dataset){
old_val = dataset['initialValue']
}
// if (old_val){
if (old_val === new_val){
//
} else {
changed_elements[cur_el.name] = cur_el.value
}
}
// }
}
$.ajax({
headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() },
url: '/user_account/change_avatar_confirm/',
url: '/user_account/change_profile_confirm/',
type: "POST",
// async: true,
cache: false,
processData: false,
contentType: false,
// enctype: 'json',
data: JSON.stringify(data),
data: JSON.stringify(changed_elements),
success: function(data){
middleWareJS()
document.querySelector(".avatar_user_profile").src = data.url;
document.querySelector(".info_profile").innerHTML = data.html;
},
error: function (data){