32 lines
775 B
HTML
32 lines
775 B
HTML
|
<!DOCTYPE html>
|
||
|
<head>
|
||
|
<meta charset="utf-8">
|
||
|
<script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js"></script>
|
||
|
</head>
|
||
|
|
||
|
<body>
|
||
|
<button id="send">发送复杂数据</button>
|
||
|
|
||
|
<script>
|
||
|
var data = new Object();
|
||
|
data["name"] = "XerCis";
|
||
|
data["message"] = "This is the message from ajax(spice4) !";
|
||
|
data["number"] = "2015012755";
|
||
|
data["grade"] = new Array();
|
||
|
data["grade"].push({"Chinese": 70});
|
||
|
data["grade"].push({"Math": 80});
|
||
|
data["grade"].push({"English": 90});
|
||
|
$("#send").click(function () {
|
||
|
$.ajax({
|
||
|
type: 'POST',
|
||
|
url: "/test",
|
||
|
data: data,
|
||
|
success: function (response) {
|
||
|
alert(response);
|
||
|
}
|
||
|
});
|
||
|
})
|
||
|
</script>
|
||
|
</body>
|
||
|
</html>
|