2011-02-24 2 views
0

사전에있는 요소의 수를 jsonresult로 반환하려고 시도합니다.> 3.6k; 내 코드 :asp mvc 2 json 결과를 반환

$('#go').click(function() { 
     $("#content").empty().html('<img src="Content/loading.gif" style="top:100px;left:100px;"/>'); 
     $.ajax({ 
      type: 'POST', 
      url: '<%= Url.Action("LoadContent","Home") %>', 
      async: true, 
      data: { 
       block: $('input[name=block]:checked').attr('value'), 
       type: $('input[name=type]:checked').attr('value'), 
       begin: $('#begindate').attr('value') + " " + $('#begintime').attr('value'), 
       end: $('#enddate').attr('value') + " " + $('#endtime').attr('value') 
      }, 
      dataType: 'json', 
      success: function (response) { 
       alert(response); 
       $.plot($("#content"), repsonse); 
      } 
     }); 
    }); 

및 서버 측 :

public JsonResult LoadContent(string block,string type,string begin,string end) { 
     List<FinalResult> result = Core.LetThePartyBegin(DateTime.Parse(begin), DateTime.Parse(end), block); 
     Dictionary<DateTime, double> returnValue = new Dictionary<DateTime, double>(); 
     result.ForEach(p => 
      p.Result.ForEach(q => returnValue.Add(p.Datetime + new TimeSpan(0, 0, q.Number), q.W))); 
     return Json(returnValue); 
    } 

때문에, JSON (ReturnValue를)은 3600 개 값을 포함하고 난 오류 500 내부 서버 오류 받고 있어요; Json (returnValue.Take (100))을 설정하면 작동합니다. jsonresult의 크기에 제약이 있습니까?

+0

당신은 json의 start20 및 end 20 chracters를 반환 할 수 있습니까? 오류를 찾는 데 도움이 될 수 있습니다. –

+0

방법 ?? 그 간단한 사전, 모르겠 무엇을 보여줄 수 – eba

+0

오류의 세부 사항은 무엇입니까? – roryf

답변

1

아약스 응답의 최대 크기가 있습니다. (확실하지 않지만 4M이라고 생각합니다.)

의도 한 응답이이 최대 값보다 클 수 있습니다. 또한 최대 크기보다 작은 하위 집합을 반환 할 때 왜 작동하는지 설명 할 수 있습니다.

확인하면 날짜

0

하나는 구문 분석되지 않은 자세한 오류 메시지. 그들이 모두 유효하다는 것이 확실합니까?