거의 2 년 전에 php/ajax 코멘트 스크립트를 다운로드했으며이 작은 문제는 첫날부터있었습니다. 나는 저자에게 연락하려고 시도했지만, 그는 어디에서 찾을 수있는 사람이 아닙니다.Ajax POST 시스템과 함께 코멘트 시스템
가끔 "보내기"버튼을 클릭하면 버튼이 비활성화 상태로 유지되고 아무런 변화가 없습니다. 애니메이션으로 바쁜 그림을 계속해서 보여줍니다. 오류 메시지가 전혀 표시되지 않습니다.
당신 중 누구라도이 문제를 도와 줄 수 있는지 궁금합니다.
<div class="comment_heading">Leave a Comment</div>
<div class="post_comment">
<textarea name="txtpostcomment" id="txtpostcomment-'.$postid.'" class="txtpostcomment"></textarea>
<button class="btnpostcomment" id="btnpostcomment-'.$postid.'" onclick="comment('.$postid.');" type="button">Send</button>
<input type="hidden" name="token" id="token" value="'.$_SESSION['token'].'">
<script>document.getElementById("txtpostcomment-'.$postid.'").focus();</script>
</div>
comment = function(postid1)
{
var txt = $('#txtpostcomment-'+postid1);
var btn = $('#btnpostcomment-'+postid1);
var comment1 = $(txt).val();
var token = $("#token").val();
$(btn).css('background-image', 'url(/comments/submit-busy.gif)');
$(btn).attr('disabled', true);
$.post("/comments/submit.php",{commenting:1, postid:postid1, comment: comment1, name: name, token: token},
function(msg)
{
if(msg.status)
{
$('.post_comment .error_msg').remove();
$('.comment-list-'+postid1).prepend(msg.html);
$(txt).val('');
$('.comChars').empty();
}
else
{
$('.post_comment .error_msg').remove();
$('.error_msg').clone().appendTo('.post_comment');
$('.error_msg:last').append(msg.error);
}
$(btn).css('background-image', 'none');
$(btn).attr('disabled', false);
$(txt).attr('disabled', false);
},'json');
}
$ .ajax에는 더 많은 옵션과 유연성이 있습니다. –