post.js
检索POST数据备份AJAX/jQuery的
$.post(
"/scripts/update.php",
{id: testId, age: testAge},
function(data) {
$(".testDiv").html(data.testId);
$(".testDiv2").html(data.testAge);
},
"json"
);
update.php
$userId = $_POST["id"];
$userAge = $_POST["age"];
// contact database and retrieve user Id and user name...
echo json_encode(array("testId"=>$userId, "testAge"=>$userAge));
我如果我拿出, "json");
代码,我可以将信息传递给update.php
得很好,但不能检索任何数据。添加json后,我无法检索或发送数据...
我在做什么错?
data.testId&data.testAge不从update.php回到那里各自的值 – 2012-04-15 13:54:11