开发者

HTTP error on adding large data using jquery ajax

I have created a good html/javascript program in displaying ajax in my jqgrid. But just recently, I noticed that when I try to save large or many data to save to my table line, it will return http:error.

I really don't understand whats wrong when I can successfully saved small numbers of lines. Someone told me that it was my html/javascript that has a problem since when I try to trace it with delphi(the one I used to create my webservice), it doesn't go into my code (when saving many lines), and will go into my code if only less than 10 line data that i will save (there's no error in tracing). Here's a data that I am sending to my webservice/html request:

{
"SessionID":"66KuzRH1w1sWCM188q4k8BTJb5ijG81v",
"operation":"add",
"transaction_date":"7/27/2011",
"supplier_id":"10000000108",
"wood_specie_id":"1",
"lines":[
     {"plank_number":"1","thickness":"4","width":"6","length_t":"8","quantity":"1","board_foot":"16.00","wood_classification_id":"1","price":"15"},
     {"plank_开发者_如何学运维number":"2","thickness":"45","width":"6","length_t":"8","quantity":"1","board_foot":"180.00","wood_classification_id":"1","price":"15"},

     .
     .
     .
     .
     {"plank_number":"22","thickness":"3","width":"6","length_t":"8","quantity":"1","board_foot":"12.00","wood_classification_id":"1","price":"15"},
     {"plank_number":"23","thickness":"4","width":"6","length_t":"7","quantity":"1","board_foot":"14.00","wood_classification_id":"1","price":"15"}
   ],
"scaled_by":"JAYSON","tallied_by":"TALLIED BY","checked_by":"CKECKED BY","total_bdft":"582.84","final":""
}

here's the code in adding my line data:

function tallyAddData(){
  var datas = {
    "SessionID": $.cookie("SessionID"),
    "operation": "add",       
    //"transaction_num":$('#tallyNo').val(),
    "transaction_date":$('#tallyDate').val(),
    "supplier_id":$('#supplierInput').attr("name"),
    "wood_specie_id":$('#woodSpecie').attr("name"),   
    "lines":plank_data,
    "scaled_by":$('#tallyScaled').val().toUpperCase(),
    "tallied_by":$('#tallyTallied').val().toUpperCase(),
    "checked_by":$('#tallyChecked').val().toUpperCase(),
    "total_bdft":$('#tallyTotal').val(),
    "final":"",
  };
  alert(JSON.stringify(datas));  
  $.ajax({
    type: 'GET',
    url: 'processjson.php?' + $.param({path:'update/tallyHdr',json:JSON.stringify(datas)}),
    dataType: primeSettings.ajaxDataType,
    success: function(data) {
      if ('error' in data)
      {
        showMessage('ERROR: ' + data["error"]["msg"]);
      }
      else{
        $('#tblTallyHdr').trigger('reloadGrid'); 
      }
    }
  });
}  


your are using the Query string to pass the data - the Query string size is limited (http://en.wikipedia.org/wiki/Query_string) I recommend on passing the data as post:

$.ajax({
  type: 'POST',
  url: url,
  data: data,
  success: success,
  dataType: dataType
});

you can also read about Jquery post (http://api.jquery.com/jQuery.post/)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜