When I click on the news headline, I try to update the content of the dialog box so that when I click on the "Share" button, the content of the selected news will appear in the dialog box.
The problem is that when you click on a button, several dialog boxes are called at once.
Here is the function code that displays the news and updates the content of the social buttons. networks:
<div id="ya-share1" class="ya-share2" data-services="vkontakte,facebook,odnoklassniki"></div> $(document).on('click', '.news', function () { selectNews(); }); function selectNews() { $.post('php/select_news.php').done(function (data) { var share1 = Ya.share2('ya-share1', { content: { url: 'http://babys-joy.ru/news' } }); share1.updateContent({ url: 'http://babys-joy.ru/news' }); }); }