.getjson回调函数

res是定义的json类

//回调函数
string strJson = JsonConvert.SerializeObject(res);
string callback = Request.QueryString["jsoncallback"];
string data = 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();

posted @ 2017-07-23 11:46  皮皮木有小JJ  阅读(297)  评论(0编辑  收藏  举报