本文共 560 字,大约阅读时间需要 1 分钟。
JSONP是一种特殊的数据获取格式,在Aicton中直接调取时会出现问题。本文将详细介绍如何处理JSONP调取
protected virtual ActionResult CreateJSON(object data) { string JSON = data.JsonSerialized(); string callBack = Request["CallBack"]; if (string.IsNullOrWhiteSpace(callBack)) { return Json(data, JsonRequestBehavior.AllowGet); } else { return Content(string.Format("{0}({1})", callBack, JSON)); } }
此外,在
ActionFilterAttribute Controller 上做方法标记,可以确保JSONP请求正常处理转载于:https://www.cnblogs.com/dxqNet/p/8532676.html