从$ .ajax接收GET的问题

时间:2013-02-10 03:17:34

标签: php jquery ajax

嘿伙计们我想收到以下内容

function sendUserfNotes() {
    $.ajax({
        type: "GET",
        url: '/pcg/popups/grabnotes.php',
        data: {
            'nameNotes': notes_name.text(),
        },
        success: function () {
            alert(notes_name.text());
        }
    });
}

在接收方结束时我有以下内容:

<?php 
    $test = $_GET['nameNotes'];
    echo $test;
?>

但这里没有任何事情发生。它通过但我无法获得GET发送的价值?我不知道它的发送位置是由JQuery UI对话框打开的。需要帮助。

1 个答案:

答案 0 :(得分:1)

成功回调:

success: function () {
    alert(notes_name.text());
}

您没有从请求中检索数据。来自jQuery文档:

  

类型:Function(Object data,String textStatus,jqXHR jqXHR)A   如果请求成功,则调用该函数。功能得到   传递了三个参数:从服务器返回的数据,格式化   根据dataType参数;描述状态的字符串;

您应该使用:

success: function (data) {
    alert(data);
}
相关问题