[ 4 posts ]

gaoxiang

  • Username: gaoxiang1985
  • Joined: Thu Oct 08, 2009 6:11 am
  • Posts: 35
  • GitHub: gaoxiang
  • Gists: gaoxiang
  • IRC: very thing is possib
  • Offline
  • Profile

The problem about JSON and XHR

Post Posted: Thu Oct 22, 2009 5:59 pm
+0-
I'm having a problem with JSON and XHR.

send data to server with FROM SUBMIT
CODE:
var sUrl = "<%= request.getContextPath() %>/master/jsonKsmst400.do?command=excel";
var jsonAllRecord = YAHOO.lang.JSON.stringify(liveDataList);
var formObject = document.getElementById('aform');
var ohide = document.getElementById('hideData');
ohide.value = jsonAllRecord;
formObject.action = sUrl;
formObject.submit();
use this way , server can get whole data. the data's count is 164160. and it works!!

send data to server with XHR
CODE:
var jsonAllRecord = YAHOO.lang.JSON.stringify(liveDataList);
var postData = "excelData=" + jsonAllRecord;
var sUrl = "<%= request.getContextPath() %>/master/jsonKsmst400.do?command=excel";
var request = YAHOO.util.Connect.asyncRequest('POST', sUrl, callback, postData);
use this way , server get part of data. the data's count is 84130. and it has error!!
erroe msg is :
net.sf.json.JSONException: Unterminated string at character 84970 of

How can i do ?

Peter Foti

  • Username: Fotiman
  • Joined: Thu Sep 17, 2009 10:09 am
  • Posts: 128
  • Offline
  • Profile

Re: The problem about JSON and XHR

Post Posted: Fri Oct 23, 2009 7:15 am
+0-
I would suggest you install Wireshark (http://www.wireshark.org/download.html) on your client PC and use it to compare the http requests being sent in both cases. That might offer some clue.

gaoxiang

  • Username: gaoxiang1985
  • Joined: Thu Oct 08, 2009 6:11 am
  • Posts: 35
  • GitHub: gaoxiang
  • Gists: gaoxiang
  • IRC: very thing is possib
  • Offline
  • Profile
Tags:

Re: The problem about JSON and XHR

Post Posted: Sun Oct 25, 2009 4:33 pm
+0-
Hi,Peter Foti,thanks for your help!!

gaoxiang

  • Username: gaoxiang1985
  • Joined: Thu Oct 08, 2009 6:11 am
  • Posts: 35
  • GitHub: gaoxiang
  • Gists: gaoxiang
  • IRC: very thing is possib
  • Offline
  • Profile
Tags:

Re: The problem about JSON and XHR

Post Posted: Tue Oct 27, 2009 1:56 pm
+0-
Hi,
Use this tool to find the sent data is ok.
By the way , use XHR send 100 records there is no problem.When i use XHR send 1500 records there is error.

anyone konws? please help me,Thanks.
  [ 4 posts ]
Display posts from previous:  Sort by  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum