Files
tripwithbonus/static/js/user_profile.js
2023-07-29 17:50:32 +03:00

111 lines
3.0 KiB
JavaScript

function writeMessage(){
$.ajax({
headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() },
url: '/ru/user_account/new_msg_to_user/',
type: "POST",
// async: true,
cache: false,
processData: false,
contentType: false,
// enctype: 'json',
// data: formData,
success: function(data){
// location.href = '/profile'
document.querySelector(".info_profile").innerHTML = data.html;
},
error: function (data, exception){
console.log(400)
}
});
}
function technicalSupport(){
$.ajax({
headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() },
url: '/ru/user_account/new_msg_to_support/',
type: "POST",
// async: true,
cache: false,
processData: false,
contentType: false,
// enctype: 'json',
// data: formData,
success: function(data){
console.log('data received')
// location.href = '/profile'
document.querySelector(".info_profile").innerHTML = data.html;
},
error: function (data, exception){
console.log(400)
}
});
}
function mySubscription(){
$.ajax({
headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() },
url: '/ru/user_account/subscribe/',
type: "POST",
// async: true,
cache: false,
processData: false,
contentType: false,
// enctype: 'json',
// data: formData,
success: function(data){
console.log('data received')
// location.href = '/profile'
document.querySelector(".info_profile").innerHTML = data.html;
},
error: function (data, exception){
console.log(400)
}
});
}
function myProfile(){
$.ajax({
headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() },
url: '/ru/user_account/change_profile/',
type: "POST",
// async: true,
cache: false,
processData: false,
contentType: false,
// enctype: 'json',
// data: formData,
success: function(data){
console.log('data received')
// location.href = '/profile'
document.querySelector(".info_profile").innerHTML = data.html;
},
error: function (data, exception){
console.log(400)
}
});
}
function confirmRemove(el) {
let place = document.querySelector('.button_remove_route')
// let new_button = document.querySelector('.cancel_remove')
// if(!button){
let cancel_button = document.createElement('button')
cancel_button.className = "cancel_remove";
cancel_button.innerText = "Отменить удаление";
place.appendChild(cancel_button);
// }
el.classList.add('confirm_remove')
el.innerText = 'Подтвердить удаление'
}