我需要向ajax函數發送兩個參數。我怎樣才能得到我的PHP文件中的值?我只是寫$ comment = $ _ GET [「comment」];但是這並沒有發送書面價值。在使用原型的php腳本中獲取參數的值
我的原型腳本如下:
comment= $F('comment'); //text from textarea
name= $F('name'); // text from text box
var ajaxUrl = 'addcomment.php';
new Ajax.Request(ajaxUrl,
{
method:'post',
parameters: {comment: comment, name: name},
onSuccess: function(data){
alert(data.responseText);
}
});
PHP:
$comment=$_GET["comment"];