1.1.21 add function for checking the status of the switch finish_subscribe_msg

This commit is contained in:
2024-06-28 15:17:39 +03:00
parent e2b7b0d356
commit afb0ea0bed
2 changed files with 31 additions and 1 deletions

View File

@@ -804,6 +804,30 @@ function send_subscribe (el, id, for_movers, subscribe){
}
}
function updSwitchState(el){
let stateToSend = el.checked
$.ajax({
headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() },
url: '/subscribes/receive_finish_subscribe_msg/',
type: "POST",
// async: true,
cache: false,
processData: false,
contentType: false,
// enctype: 'json',
data: { receive_finish_subscribe_msg: stateToSend },
success: function(response){
alert(response)
},
error: function (data, exception){
console.error('Произошла ошибка при выполнении AJAX запроса:', exception);
console.log(data.responseText);
}
});
}
var last_open_curtain = null
function open_curtain_w_btn_profile () {