ASP.NET 网页 2 示例 api.cshtml 文件:
此代码返回由 jquery $.ajax 调用识别的正确 json:
@{
var data1 = AppFunctions.PerformSelect(AppState["U1select"].ToString());
var jsondata = Json.Encode(data1);
Response.ContentType = "application/json; charset=utf-8";
Response.Write(jsondata);
}
但事实并非如此。为什么?
@{
var data1 = AppFunctions.PerformSelect(AppState["U1select"].ToString());
var jsondata = Json.Encode(data1);
Response.ContentType = "application/json; charset=utf-8";
}
@jsondata