fetch('/events/api/get', { method: 'POST', body: sq[0] })
.then(response => response.json())
.then((data) => {
console.log(data);
data.map((response) => {
content = response.location !== '' ? '<span data-type="location">' + response.location + '</span>' : '';
readyDescription = response.content.matchAll(/<p[^>]*>(([^>]|.)*?)<\/p>/ug);
content += '<span data-type="description">' + readyDescription[1][0].length > 234 ? mb_strimwidth(readyDescription[1][0], 0, 234, '...') : readyDescription[1][0] + '</span>';
dateFormat = [
moment(response.date_from, 'd/m/Y'),
moment(response.date_to, 'd/m/Y')
];
eventCard = '<span id="date">' + response.date_to ? dateFormat.join(' - ') : dateFormat[0] + '</span><img src="' + response.titleImage + '" alt="' + response.title + '" />';
eventCard += '<span id="title">' + response.title + '</span><p>{content}</p><a href="/events/' + response.id + '">Show more</a>';
$('.slider').append('<li>' + eventCard + '</li>');
});
$('.load-screen-services').addClass('list-smart-close');
})
.catch(() => { $('.load-screen-services').addClass('list-smart-close'); });
[{"id":1,"date_to":null,"location":"Moscow","tematic":"Conferences","type":null,"date_from":"2022-11-10","title":"Full-service real estate. Accents-2022","titleImage":"/images/content/08-04-2022_05:39:24.jpg","content":"<div id=\"matherial\"><p>Any real estate object goes through several life stages, starting from the selection and approval of a plot to ownership and operation, regardless of whether it is residential or commercial real estate. In this process, any owner faces many obstacles, with which he is helped to cope by real estate market experts at each stage. Let's talk in the format of a round table on this topic with accents and features of 2022.</p>\n\n<p><strong>The following persons are invited to participate::</strong></p>\n\n<p>Design companies, engineering firms, architectural bureaus, developers, builders, finishing companies, owners of residential and commercial real estate, management and service companies, consultants-brokers.</p>\n\n<p> </p></div>\n"}]