前台JQ代码:
$.ajax({
type: "post",
url: "Default.aspx/PipeData",
contentType: "application/json;charset=utf-8",
dataType: "json",
success: function (res) {
alert(res.d)
},
error: function (xmlReq, err, c) {
alert("error!!");
}
});后台代码:
public static string PipeData()
{
string myjson = "hello";
return myjson;
}
本文介绍了一个使用 jQuery 的 AJAX 示例,包括前端发起 POST 请求并获取后台返回的 JSON 数据,以及简单的错误处理。
1481

被折叠的 条评论
为什么被折叠?



