Всем привет, не работает ajax метод на добавление комментариев под пост. Точнее в бд они отправляются, а вот нужный div не обновляется. Стоит на функции before и все. что делать подскажите пж
<script >
$(document).ready(function () {
$(«#coment<?php echo $art['id'];?>»).on('click', function(){
let id = «<?php echo $art['id'];?>»; let text = $('#text<?php echo $art['id'];?>').val(); let author = «<?php echo $us['id'];?>»;
$.ajax ({ url:«comment.php», type:«POST», cache:false, data:{«id»:id,«text»:text,«author»:author}, dataType:«json»,
beforeSend:function (){ $('#arphoto<?php echo $art['id'];?>').html («Обновление, ждите<?php echo $al;?>»);
alert('ждем<?php echo $art['id'];?>');
}, success:function (data){ $('#comment<?php echo $com['id'];?>').html (data);
}
});}); }); </script>
<div class=«comment» id=«comment<?php echo $art['id'];?>» > <img src="../../../projectimg/closecom.png" width=«10px» height=«auto» class=«c» id=«c<?php echo $art['id'];?>» onclick=«document.getElementById('comment<?php echo $art['id'];?>').setAttribute( 'style', 'visibility: hidden; margin-top:-100px; z-index:-2; transition: 700ms;');
»> <?php $query = mysqli_query($connection,«SELECT * FROM comments WHERE artid = '{$art['id']}' »); while($com = mysqli_fetch_assoc($query)){ ?>
<?php
$au = mysqli_query($connection,«SELECT name,surname,id,photo,special,curentstat,lc FROM member WHERE id = '{$com['uid']}'»); $a = mysqli_fetch_assoc($au); ?> <div class=«test» id=«test<?php echo $com['id'];?>»> <a class=«comaut"href=„member.php?id=<?php echo $a['id'];?>“><img class=„authcomimg"src=“../uploads/<?php echo $a['photo'];?>» width =«50px;» height = «auto»><b class=«comaut»><?php echo $a['name']; ?> <?php echo $a['surname'];?></b><?php if($a['special']){?><img class=«spec"width=„20px“ height=„auto"src=“../../../projectimg/spec/<?php echo $a['special'];?>» ><?php }else{}?></a><b class=«curent»><?php echo $a['curentstat'];?></b>
<script src='script/autosize.js'></script> <script> autosize(document.querySelectorAll('textarea')); </script>
<b class=«comdate»>Дата: <?php echo date(«d.m.yy, Время H.i»,strtotime($com['date']));
?></b> <b class=«univercom»><?php echo $a['lc'];?></b>
<textarea readonly=«on» class=«comtext» id=«comtext<?php echo $com['id'];?>»><?php echo $com['text'];?></textarea>
<hr class=«under-com»>
</div> <?php } ?>
<div class=«feed»> <script> $(function() { var txt = $('#comments'), hiddenDiv = $(document.createElement('div')), content = null;
txt.addClass('noscroll'); hiddenDiv.addClass('hiddendiv');
$('body').append(hiddenDiv);
txt.bind('keyup', function() { content = txt.val(); content = content.replace(/\n/g, '<br>'); hiddenDiv.html(content);
txt.css('height', hiddenDiv.height());
}); }); </script>
<img src="../../../projectimg/closecom.png" width=«50px» height=«auto» class=«comclo» onclick=«document.getElementById('comment<?php echo $art['id'];?>').setAttribute( 'style', 'visibility: hidden; margin-top:-100px; z-index:-2; transition: 700ms;');»>
<?php if(!$us['id']){ ?>
<script type=«text/javascript»> $(document).ready(function(){ document.getElementById('text<?php echo $art['id'];?>').setAttribute( 'style', 'visibility: hidden; margin-top:-100px; z-index:-2; transition: 700ms;'); document.getElementById('button<?php echo $art['id'];?>').setAttribute( 'style', 'visibility: hidden; margin-top:-100px; z-index:-2; transition: 700ms;'); });
</script>
<?php } ?>
<form method=«POST»> <textarea id=«text<?php echo $art['id'];?>» class=«feed» name=«text» type=«text» required placeholder=«Оставьте комментарий» value=«<?php echo trim($text['text']);?>»><?php if(!$us['id']){ echo $warning; }else{}?></textarea> <br><br> <div class=«coment» id=«coment<?php echo $art['id'];?>„type=„button“ name=„coment<?php echo $art['id'];?>“><p align=„center“>Комментировать</p></div> </div> </form>
</div>