function CommentAll() {
$.ajax({
url: "/ashx/myzhuye/Detail.ashx",
type: "post",
contentType: "application/x-www-form-urlencoded; ",
dataType: "json",
data: { methodName: "GetAllComment", str1: "atr1", "str2": "str2" },
success: function (data) {
$.each(data,
function (i, v) {
alert(v);
});
}
});
}
private void GetAllComment(HttpContext context)
{
string methodName = context.Request.Params["methodName"];
string str1 = context.Request.Form["str1"];
string str2 = context.Request["str2"];
List<string> comments = new List<string>();
comments.Add(methodName);
comments.Add(str1);
comments.Add(str2);
string commentsJson = new JavaScriptSerializer().Serialize(comments);
context.Response.Write(commentsJson);
}
function CommentAll() {
$.ajax({
url: "/ashx/myzhuye/Detail.ashx",
type: "get",
contentType: "application/json; ",
dataType: "json",
data: { methodName: "GetAllComment", str1: "atr1", "str2": "str2" },
success: function (data) {
$.each(data,
function (i, v) {
alert(v);
});
}
});
}
function CommentAll() {
$.get("/ashx/myzhuye/Detail.ashx",
{ methodName: "GetAllComment", str1: "atr1", "str2": "str2" },
function(da) {
alert(da);
});
}
function CommentAll() {
$.getJSON("/ashx/myzhuye/Detail.ashx",
{ methodName: "GetAllComment", str1: "atr1", "str2": "str2" },
function (da) {
$.each(da,function(i, v) {
alert(v);
})
});
}
function CommentAll() {
$.post("/ashx/myzhuye/Detail.ashx",
{ methodName: "GetAllComment", str1: "atr1", "str2": "str2" },
function (da) {
$.each(da, function (i, v) {
alert(v);
});
}, "json");
}
扩展:https: