你好,
你可以到下面网站下载一个juery脚本,引用到你的项目中稍微做下处理即可。
http://code.google.com/p/jquery-json/
$(document).ready(function() {
$("#Text1").click(function() {
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: "WebService.asmx/HelloWorld",
data: "{}",
dataType: "json",
success: function(data) { displayResult(data); }
})
}
);
function displayResult(data) {
alert(data.d);
}
var vobj = {
_type: "Person",
name: "Hugo",
age: 23,
address: {
country: "china"
}
}
$("#Button1").click(function() {
$.ajax({
type: "POST",
url: "Default.aspx",
dataType: "json",
data:$.toJSON(vobj)
})
});
});
得到的结果如下:Request.Form[0]="{"_type":"Person", "name":"Hugo", "age":23, "address":{"country":"china"}}“Microsoft Online Community Support