我使用AJAX從服務器獲取數據。以下是php文件。什麼是PHP中的[object]?
myphp.php
$Product_name = $_POST['path'];
$message['message'] .= '<tr><td>' . ($Product_name) . '</td></tr>';
$message['message'] .= '</table>';
echo json_encode($message);
......
當我在html頁面得到響應時,我得到'[object]'。
$.ajax({
type: "POST",
url: "uploader.php",
async: false,
data: {submit_question:'1',
path: $("[name='path']").val()},
success: function(response, status){
var ajax_message = jQuery.parseJSON(response);
$('#status').html(ajax_message.message);
}
});
有人能告訴我這是什麼意思?
這意味着你有一個對象。顯示更多代碼,否則這很難精確回答。 – deceze
你究竟在執行什麼來查看你「獲得」了什麼?你怎麼稱呼你的阿賈克斯? – Pelshoff
你在你的ajax成功函數裏面使用alert()嗎? – Shef