You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
684 B
34 lines
684 B
le_crud = {
|
|
|
|
rem: function(id,el_id)
|
|
{
|
|
u = window.location.href;
|
|
el = document.querySelector(el_id);
|
|
if (typeof el !=='object') return false;
|
|
|
|
data = {id:id,method:"remove_it"};
|
|
|
|
if(!confirm("Удалить статью?")) return false;
|
|
|
|
|
|
fetch(u,
|
|
{
|
|
method: 'POST',
|
|
body: JSON.stringify(data),
|
|
headers: {'Content-Type': 'application/json'}
|
|
}
|
|
).then ((resp)=>{return resp.json()}).then
|
|
((resp)=>{
|
|
if (!resp.success) {alert('Произошла ошибка!'); return false;}
|
|
el.remove();
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} |