<!DOCTYPE html><
html
><
head
><
meta
http-equiv
=
"Content-Type"
content
=
"text/html; charset=utf-8"
/> <
title
></
title
>
<
meta
charset
=
"utf-8"
/> <
script
src
=
"bower_components/jquery/dist/jquery.min.js"
></
script
></
head
><
body
> <
input
id
=
"sava1"
value
=
"保存RequestForm"
type
=
"button"
/> <
input
id
=
"sava2"
value
=
"保存RequestBody"
type
=
"button"
/> <
script
> $("#sava1").click(function () {
$.post("http://localhost:5000/additem", { ID: 112, Name: "李四", Birthday: "2017-01-23" }, function (result) {
alert(result.Message+result.Content);
},"json")
})
$("#sava2").click(function () {
$.ajax({
type: "POST",
url: "http://localhost:5000/additem",
contentType: "application/json",
dataType: "json",
async: true,
data: JSON.stringify({ "ID": 112, "Name": "李四", "Birthday": "2017-01-23 12:12:12" }),
success: function (result) {
alert(result.Message + result.Content);
}
});
})
</
script
></
body
></
html
>