5
json 결과에 문제가 있습니다. jquery에서 호출 할 때 성공 함수를 실행하는 대신 파일을 저장합니다. get jquery 요청은 document.ready 함수에서 발생합니다.JsonFile을 반환하는 MVC3 컨트롤러
도움을 주시면 감사하겠습니다.
public ActionResult Locations()
{
LocationsModel lm = new LocationsModel();
return Json(lm.getPins(), JsonRequestBehavior.AllowGet);
}
나는 또한 시도 : 다음과 같이
public JsonResult Locations()
{
LocationsModel lm = new LocationsModel();
return Json(lm.getPins(), JsonRequestBehavior.AllowGet);
}
JQuery와는 다음과 같습니다
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: this.href,
data: "{}",
dataType: "json",
success: function (msg) { getPins_success(msg); },
error: OnError
});
감사합니다, 크리스
편집 :
결코그것이 마음 에이 이런. 일단 json 요청을 컨트롤러의 다른 액션으로 옮기고 모든 뷰를로드했습니다. 이제 구문 분석 문제가 있지만 문제는 모두 함께 있습니다.
'AllowGet'과'type : "POST"'? –