function Test() {
var d = {
"q":"queryCondition",
"user":
{
"Id": 1,
"Name": '张三',
"Age": 18
}
};
$.ajax({
type: "POST",
contentType: "application/json",
url: "QueryExample.aspx/Insert",
dataType: "json",
data: JSON.stringify(d), //这里需将d转换为字符串
success: function (result) {
//var date = eval('new ' + eval(result.d.ProductDate).source) //从C#的DateTime类型转换为js的date类型
//获取返回实体类的值
var id = result.d.id;
var name = result.d.name;
var age = result.d.age;
},
error: function (error) {
alert(error.responseText);
}
});
}
请发表评论