2011-07-27 40 views
0

我在jqgrid中創建了一個很好的html/javascript程序來顯示ajax。但就在最近,我注意到當我嘗試保存大量或許多數據以保存到我的表格行時,它將返回http:error使用jQuery添加大數據時發生HTTP錯誤ajax

我真的不明白什麼是錯誤的,當我可以成功地保存少量的行。有人告訴我,這是我的HTML/JavaScript有一個問題,因爲當我試圖用delphi(我用來創建我的web服務)跟蹤它,它不會進入我的代碼(當保存多行),並且將進入我的代碼,如果只有少於10行數據,我將保存(跟蹤沒有錯誤)。下面是我發送給我的web/HTML請求數據:

{ 
"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":"" 
} 

下面是增加我行數據的代碼:

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

回答

1

你正在使用的查詢字符串來傳遞數據 - 查詢字符串大小是有限的(http://en.wikipedia.org/wiki/Query_string) 我建議在傳遞數據後:

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

你也可以閱讀關於jQuery的崗位(HTTP:// API。 JQ uery.com/jQuery.post/)

+0

我確實已經改變了我的代碼,它沒有工作。我仍然收到'HTTP錯誤'。 :( – jayAnn

+0

嘗試使用http://www.fiddler2.com/fiddler2/來查看請求結果,你也可以嘗試http://getfirebug.com/它更友好 – kleinohad

+0

當我檢查我的火蟲evrytime我加小數據,沒關係,但是在大數據中,好像不能繼續,我的XMLHTTPRequest變爲紅色,然後錯誤就出來了 – jayAnn

相關問題