<?php
$arr=array('name'=>'张三','age'=>19,'sex'=>'男','status'=>'未婚','className'=>'FG18');
$arr=array('name'=>'张三','age'=>19,'sex'=>'男','status'=>'未婚','className'=>'FG18');
$result=json_encode($arr);
echo $result;
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script src="jquery-1.11.1.js"></script>
</head>
<body>
<input type="button" id="btn1" value="点击ajax提交">
</body>
<script>
$(function(){
$('#btn1').click(function(){
$.ajax({
url: "admin.php",
type: "GET",
dataType: 'json',
success: function (json) {
alert(json.name + " " + json.age + " " + json.sex);
}
});
})
});
</script>
</html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script src="jquery-1.11.1.js"></script>
</head>
<body>
<input type="button" id="btn1" value="点击ajax提交">
</body>
<script>
$(function(){
$('#btn1').click(function(){
$.ajax({
url: "admin.php",
type: "GET",
dataType: 'json',
success: function (json) {
alert(json.name + " " + json.age + " " + json.sex);
}
});
})
});
</script>
</html>