여러 개의 json 객체를 반환하지만 해당 객체를 반환하는 방법을 모르겠습니다. 반환 된 json 객체를 가져 와서 Ajax 요청에 보내고 싶습니다. 이것은 내 ActionResult입니다 :컨트롤러에서 여러 json 객체를 반환하십시오.
public ActionResult AutoCompleteEventName(string eventName)
{
Event ev = new Event();
ev.Name = eventName;
var searchEvent = EventService.Instance.Search(ev);
var totalCount = EventService.Instance.SearchCount(ev);
}
Ajax 요청에
var returnField = new { searchEvent = "searchEvent", totalCount = totalCount.ToString() };
return Json(returnField, JsonRequestBehavior.AllowGet);
아래와 같이 컨트롤러 반환 결과에