2011-02-09 8 views
0

私は、変数としてmemberIDをポストする必要がある次のJquery関数を持っています。そして、私は$memberID = $_REQUEST['memberID']というadd_comment.phpファイルでそれを捕捉したいのですが、nullを返します。Jquery .post()メソッドの問題

$('a.comment').die("click").live("click", function(e){ 

     var getpID = $(this).parent().attr('id').replace('commentBox-','');  
     var comment_text = $("#commentMark-"+getpID).val(); 


     if(comment_text != "Write a comment...") 
     { 
      $.post("lib/actions/add_comment.php?comment_text=" 
         +comment_text+"&post_id="+getpID,{ memberID : 5 

      }, function(response){ 

       $('#CommentPosted'+getpID).append($(response).fadeIn('slow')); 
       $("#commentMark-"+getpID).val("Write a comment...");      
      }); 
     } 

    }); 
+0

「comment_text」をエスケープしてみることはできますか? – peakit

答えて

0

あなたはURL-encode (with encodeURIComponent)comment_textする必要がありますが、なぜあなただ​​けPOSTデータでそれを送信していませんか?

あなたが行うことはできません。

$.post("lib/actions/add_comment.php", { 
    comment_text: comment_text, 
    post_id: getpID, 
    memberID: 5 
}, function (response) { //etc.