M
Size: a a a
M
AK
<script>
function deleteRole() {
var select = document.getElementById("id_roles");
var role = select.options[select.selectedIndex].value;
var url = "{% url 'delete-permissions' tool_name=obj.name %}";
fetch(url, {method: 'DELETE', headers: {
'Content-Type': 'application/json;charset=utf-8'
},
body: JSON.stringify({role: role})}).then(res => res.json()).then(result => console.log(result));
location.href="{% url 'admin:index' %}";
}
</script>
TypeError: NetworkError when attempting to fetch resource.
AK
SM
OR
fetch.then(() => {твой код})
AK
fetch.then(() => {твой код})
B
SM
SM
OR
🌀
<script>
function deleteRole() {
var select = document.getElementById("id_roles");
var role = select.options[select.selectedIndex].value;
var url = "{% url 'delete-permissions' tool_name=obj.name %}";
fetch(url, {method: 'DELETE', headers: {
'Content-Type': 'application/json;charset=utf-8'
},
body: JSON.stringify({role: role})}).then(res => res.json()).then(result => console.log(result));
location.href="{% url 'admin:index' %}";
}
</script>
TypeError: NetworkError when attempting to fetch resource.
🌀
B
AK
🌀
🌀
AK
AK
🌀
AK