Ajax 代码突然停止工作?
Ajax code suddenly stopped working?
我现在正在失去理智,我不知道发生了什么。我写了一个代码,用户可以在其中写评论,一旦你提交,评论就会出现。一切都工作得很好,直到玩这个程序,我注意到当我写了一个非常大的评论时,评论气泡不是 'expanding',调整它的大小,并且这里出现错误(特别是在 if 条件下) :
$query = "select user,comment,date from comments where user='$name' and comment='$comment'";
$select = mysqli_query($connection, $query);
if($row=mysqli_fetch_array($select))
{
$name=$row['user'];
$comment=$row['comment'];
$time=$row['date'];
我不记得错误本身,起初我忽略了它,因为我想修复气泡混乱,所以我继续 CSS。完成后,我注意到除 ajax 部分外,一切正常。提交时评论不再出现(我必须刷新页面),错误也不再出现,所以我真的非常绝望。我将当前代码与旧代码进行了比较,结果完全一样,除了一些 CSS 类,我很困惑。
我只发布了那部分代码,因为它是导致评论过大时出现错误的代码,但如果需要更多请告诉我。
根据您的说法:
I compared the current code with an older one that worked and it's exactly the same, except for some CSS classes, I'm so confused.
A removed/altered CSS class 将导致 AJAX 事件不触发,如果它被调用的话。
例如
$('.test').click(function(){
如果
则不会发生
<a class="test"...>
(根据评论,)更改为:
<a class="not_a_test">
我现在正在失去理智,我不知道发生了什么。我写了一个代码,用户可以在其中写评论,一旦你提交,评论就会出现。一切都工作得很好,直到玩这个程序,我注意到当我写了一个非常大的评论时,评论气泡不是 'expanding',调整它的大小,并且这里出现错误(特别是在 if 条件下) :
$query = "select user,comment,date from comments where user='$name' and comment='$comment'";
$select = mysqli_query($connection, $query);
if($row=mysqli_fetch_array($select))
{
$name=$row['user'];
$comment=$row['comment'];
$time=$row['date'];
我不记得错误本身,起初我忽略了它,因为我想修复气泡混乱,所以我继续 CSS。完成后,我注意到除 ajax 部分外,一切正常。提交时评论不再出现(我必须刷新页面),错误也不再出现,所以我真的非常绝望。我将当前代码与旧代码进行了比较,结果完全一样,除了一些 CSS 类,我很困惑。
我只发布了那部分代码,因为它是导致评论过大时出现错误的代码,但如果需要更多请告诉我。
根据您的说法:
I compared the current code with an older one that worked and it's exactly the same, except for some CSS classes, I'm so confused.
A removed/altered CSS class 将导致 AJAX 事件不触发,如果它被调用的话。
例如
$('.test').click(function(){
如果
则不会发生<a class="test"...>
(根据评论,
<a class="not_a_test">