--前台
$.ajax({
type: "POST",
contentType: "application/json",
url: "WebForm2.aspx/GetUserName",
data: "{}",
dataType: "json",
success: function(){.......}
});
--list集合
$.ajax({
type: "POST",
contentType: "application/json",
url: "DeHx.aspx/GetUserName",
data: "", // data:"{uid:"+str+"}",
dataType: "json",
success: function(data){
$.each(data, function (key, val) {
var te = eval(data[key]);
alert(te);
});
}
});
--后台
[WebMethod(EnableSession = true)]
public static string GetUserName() //(string uid)
{
return "123";
}