这段代码有什么问题?
<html>
<head>
<script src="jquery.js"></script>
<script>
$(document).ready(function() {
$("#butt").click(function() {
var name=$("#male").val();
var age =$("#age").val();
var edu=$("#education").val();
var samy ={
"name":name,
"age":age,
"edu":edu
};
$.ajax( {
url:"email_ajax.php",
data:"q="+samy,
type:"GET",
dataType: "json",
success: function(res) {
res = $.parseJSON(res);
$("#result").html(res);
}
});
});
});
</script>
</head>
<body>
<label for="male">Male</label>
<input type="text" name="male" id="male"><br/>
<label for="Education">Education</label>
<input type="text" name="education" id="education"><br/>
<label for="age">Age</label>
<input type="text" name="age" id="age"><br/>
<input type="button" id="butt" name="butt">
<div id="result"></div>
</body>
</html>
在下一页
<?php
$da=$_GET['q'];
$data=json_decode($da);
$x=$data['name'];
$y=$data['age'];
$z=$data['edu'];
echo '<h4>'.$x.'</h4><br/>';
echo '<h4>'.$y.'</h4><br/>';
echo '<h4>'.$z.'</h4><br/>';
?>