$.post
PHPから結果を取り戻すにはどうすればよいですか?
$.post("sql/customer_save.php",{ what: "edit",customer_no: $customer_no});
phpが返信します
echo json_encode(array("customer_id"=>$customer_id,"customer_no"=>$customer_no));
結果を取り戻すには、$。postに何を置く必要がありますか?
$.post
PHPから結果を取り戻すにはどうすればよいですか?
$.post("sql/customer_save.php",{ what: "edit",customer_no: $customer_no});
phpが返信します
echo json_encode(array("customer_id"=>$customer_id,"customer_no"=>$customer_no));
結果を取り戻すには、$。postに何を置く必要がありますか?
$.post("sql/customer_save.php",{ what: "edit",customer_no: $customer_no},function(resp)
{
//resp is your response
//You can try
console.log(resp);
console.log(resp["customer_id"]); //get the value of customer_id
console.log(resp["customer_no"]); //get the value of customer_no
},"json");
また
使用することもできます
$.post("sql/customer_save.php",{ what: "edit",customer_no: $customer_no},function(resp)
{
//resp is your response
//You can try
var data = $.parseJSON(resp);
console.log(data);
console.log(data["customer_id"]); //get the value of customer_id
console.log(data["customer_no"]); //get the value of customer_no
});