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));
私は私がうまくupdate.php
に情報を渡すことができ, "json");
コードを取り出すことがあったが、あれば取得できませんバック任意のデータ。 jsonを追加した後、データを取得または送信できません...
私は間違っていますか?
data.testId&data.testAgeがupdate.phpをそこからそれぞれの値を返しません。 –