let str2 = "{'id':'147','name':'example1','address':'sample's street 1'}";
str2 = str2
.replaceAll("{'", '{"')
.replaceAll("':'", '":"')
.replaceAll("','", '","')
.replaceAll("'}", '"}');
const parsed = JSON.parse(str2);
console.log(parsed);
let response = {
id: "2318f624-a2-1157ec-bf63-ac130002-0242",
name: "РФ",
count1: 1,
count2: 441,
count3: 127,
count4: 441,
count5: 127,
count6: 441,
count7: 127,
count8: 441,
count9: 127,
count10: 441,
count11: 127
}
const {id, name, ...counts} = response;
const series = [{
name,
data: Object.values(counts),
}];
console.log(series);
document.getElementById("midBlockID").style.position= "fixed";
Как сделать так чтобы в список добавлялись новые фильмы в реальном времени без перезагрузки страницы?
- принять запрос
- проверить наличие фильма в БД
- добавить фильм в БД
- отослать сообщение по websocket