2
我有麻烦试图找出为什么我的JSON data.email响应返回null。任何人都可以建议吗?jQuery的Ajax形式与JSON响应
//javascript
$.ajax(
{
type: 'POST',
url: 'process.php',
dataType: 'json',
data: { email : "[email protected]" },
success: function(data)
{
alert("result = "+data.email);
}
});
//php (process.php)
if ($_POST['email'])
$return['email'] = $_POST['email'];
else
$return['email'] = "no email specified";
echo json_encode($return);