首页 > 代码库 > .getjson回调函数

.getjson回调函数

res是定义的json类

//回调函数
string strJson = JsonConvert.SerializeObject(res);
string callback = Request.QueryString["jsoncallback"];
string data = http://www.mamicode.com/strJson;
string result = string.Format("{0}({1})", callback, data);
Response.Expires = -1;
Response.Clear();
Response.ContentEncoding = Encoding.UTF8;
Response.ContentType = "application/json";
Response.Write(result);
Response.Flush();
Response.End();

.getjson回调函数