使用jquery ajax添加大数据时出现HTTP错误 [英] HTTP error on adding large data using jquery ajax

查看:133
本文介绍了使用jquery ajax添加大数据时出现HTTP错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在jqgrid中显示ajax时创建了一个很好的html/javascript程序.但是就在最近,我注意到当我尝试将大量或大量数据保存到表行时,它将返回http:error.

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.

当我成功保存少量行时,我真的不明白怎么了.有人告诉我,这是我的html/javascript出现问题,因为当我尝试使用delphi(我用来创建Web服务的那个)进行跟踪时,它并没有进入我的代码中(保存很多行时),并且如果我要保存的行数据少于10条,则将进入我的代码(跟踪中没有错误).这是我发送到我的webservice/html请求的数据:

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'); 
      }
    }
  });
}  

推荐答案

您正在使用查询字符串来传递数据-查询字符串的大小受到限制(http://en.wikipedia.org/wiki/Query_string) 我建议在发布时传递数据:

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
});

您还可以阅读有关Jquery帖子(http://api.jquery.com/jQuery.post/)

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

这篇关于使用jquery ajax添加大数据时出现HTTP错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆