2014-01-22 84 views
0

我試圖更新我的評論系統,並遇到了一個障礙。這是螢火蟲顯示的錯誤:ReferenceError:評論未定義:comment(1000);Form OnClick ReferenceError:評論未定義

我對這個問題感到茫然 - 任何想法?

<div class="comment_heading">Leave a Comment</div> 
<div class="post_comment"> 
<textarea name="txtpostcomment" id="txtpostcomment-1000" class="txtpostcomment"></textarea> 
<button class="btnpostcomment" id="btnpostcomment-1000" onclick="comment(1000);" type="button">Send</button> 
<input type="hidden" name="token" id="token" value="19vtyWh5iOpeKamXAQl3udqU9mMjnfKv/LnWr70M2jE="> 
</div> 

<script> 
function comment(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); 

    var dataString = 'commenting=1&postid=' + postid1 + '&comment=' + comment1 + '&name=' + name + '&token=' + token; 

    .ajax({ 
     url: "/comments/submit.php", 
     type: "POST", 
     data: dataString, 
     cache: false, 
     success: function() 
     { 
      $('.post_comment .error_msg').remove(); 
      $('.comment-list-'+postid1).prepend(msg.html); 
      $(txt).val(''); 
     }, 
     error: function() 
     { 
      $('.post_comment .error_msg').value = 'Error - Please try again'; 
     } 
    }); 

    $(btn).css('background-image', 'none'); 
    $(btn).attr('disabled', false); 
    $(txt).attr('disabled', false); 
} 
</script> 

回答

0

解決。所有我需要改變的是:

.ajax({ 

要:

$.ajax({