ajax post参数长度限制,Ajax中的POST数据大小是否有限制?
我想使用jQuery Ajax将我的页面中的数据数组发送到MVC Action。这里是我的jQuery代码:Ajax中的POST数据大小是否有限制?
$('#btnSave').click(
function() {
result = [];
$('#tblMatters tbody tr.mattersRow').each(function() {
if (!($(this).hasClass('warning'))) {
var item = {};
if ($(this).find('td.qbmatter > div.dropdown').length > 0) {
item.QBDescription = $(this).find('td.qbmatter > div.dropdown > a').text();
} else {
item.QBDescription = $(this).find('td.qbmatter').text();
}
var id = $(this).find("td:first > a").text();
item.Narrative = $("#collapse" + id).find("div.scrollCell").text();
item.WorkDate = $(this).find('td.workDate').text();
item.Hours = $(this).find('td.hours').text();
item.Person = $(this).find('td.person').text();
if ($(this).find('td.rate > div.dropdown').length > 0) {
item.Rate = $(this).find('td.rate > div.dropdown > a').text();
} else {
item.Rate = $(this).find('td.rate').text();
}
item.Amount = $(this).find('td.amount').text();
result.push(item);
}
});
var originalRecords = $("#tblSummary tr.summaryTotalRow td.summaryOriginalRecords").text();
var originalHours = $("#tblSummary tr.summaryTotalRow td.summaryOriginalHours").text();
var excludedHours = $("#tblSummary tr.summaryTotalRow td.summaryExcludedHours").text();
var totalHours = $("#tblSummary tr.summaryTotalRow td.summaryTotalHours").text();
$.ajax({
url: "/Home/SaveQBMatter",
type: "POST",
data: JSON.stringify({ 'Matters': result, 'originalRecords': originalRecords, 'originalHours': originalHours, 'excludedHours': excludedHours, 'totalHours': totalHours }),
dataType: "json",
traditional: true,
contentType: "application/json; charset=utf-8",
success: function (data) {
if (data.status == "Success") {
alert("Success!");
var url = '@Url.Action("Index", "Home")';
window.location.href = url;
} else {
alert("Error On the DB Level!");
}
},
error: function() {
alert("An error has occured!!!");
}
});
});
让我解释一下。我有一个动态构建的HTML表,我需要将这些数据存储到数据库中。在jQuery中,我有一个遍历表的循环,并将result数组中的每一行数据存储起来。然后我使用Ajax将这些数据传递给MVC Action。
这里是我的问题开始的地方......我意识到有时候它应该是这样,但有时我从Ajax得到一个错误alert("An error has occured!!!");现在我明白了,当我的result阵列越来越大。例如:如果它包含100-150项>一切都很好,但是当有超过〜150>错误时。
Ajax中是否有POST限制?我怎样才能将它设置为任何尺寸?我真的需要这个功能!请任何帮助!
我的ActionResult代码:
public ActionResult SaveQBMatter(QBMatter[] Matters, string originalRecords, string originalHours, string excludedHours, string totalHours) {
DBAccess dba = new DBAccess();
int QBMatterID = 0;
int exportedFileID = 0;
foreach (QBMatter qb in Matters) {
dba.InsertQBMatter(qb.QBDescription, qb.Narrative, qb.WorkDate, qb.Person, qb.Hours, qb.Rate, qb.Amount, ref QBMatterID);
}
ExcelTranslator translator = new ExcelTranslator();
translator.CreateExcelFile("", Matters, originalRecords, originalHours, excludedHours, totalHours);
return Json(new { status = "Success", message = "Passed" });
}
UPDATE:找到一个解决办法
JSON的最大长度!我需要增加这个值。在web.config中添加以下内容:
2013-11-27
Bryuk
+0
错误的原因是别的。使用Firebug /使用Visual Studio的断点看到你真正的问题是什么 –
+0
您将需要返回代码从调试警报的/ dev-工具 –
+0
Guuys最低。请。我仍然需要帮助! –
ajax post参数长度限制,Ajax中的POST数据大小是否有限制?相关推荐
- java中BigDecimal类型数据大小比较
一 概述 在Java中会存在数值的比较,在进行金额计算的时候,一般会通过BigDecimal类型的数字进行计算. 二 BigDecimal类型数据大小比较 if(numOne.compareTo(nu ...
- php中jquery ajax请求参数,浅谈Jquery中Ajax异步请求中的async参数的作用
之前不知道这个参数的作用,上网找了前辈的博客,在此收录到自己的博客,希望能帮到更多的朋友: test.html asy.js function testAsync{ var temp; $.ajax( ...
- ajax 参数大小限制,Ajax中的POST数据大小是否有限制?
我正在尝试使用jQuery Ajax将页面中的数据数组发送到MVC Action.这是我的jQuery代码: $('#btnSave').click( function () { result = [ ...
- ajax webservice 参数类型,JQuery Ajax WebService传递参数的简单实例
Asp.NET中利用jQuery实现Ajax时,在服务器端可以使用aspx,ashx,以及WebService等方式.最近研究了一下WebService方式,jQuery Ajax 方法调用 jQue ...
- java如何构造ajax回调参数,jQuery实现ajax回调函数带入参数的方法示例
本文实例讲述了jQuery实现ajax回调函数带入参数的方法.分享给大家供大家参考,具体如下: 不带参数的写法: function pass(htmlId,auditingFlag){ var url ...
- mvc ajax异常,使用SpringMVC的controller中能获取数据但直接跳到异常页面,使用Ajax。...
Controller代码 import java.util.Date; import org.springframework.stereotype.Controller; import org.spr ...
- ajax data参数没有值,ajax $.get的data参数无法传递
使用$.get方法,点击一次button获取两条数据,点击一次之后变量+1,之后把这个值传递到getajax.php页面的数据库查询语句中作为查询条件,如果把"page="+pag ...
- .ajax done参数,困惑jQuery .ajax .done()函数
我认为它应该be result =='true',结果是一个数据字符串 我刚查过,我说得对,报价让它工作 PHP: if($_POST['username']=='sambob'){echo 'tru ...
- Mysql查询表中每行数据大小_计算数据库中各个表的数据量和每行记录所占用空间的脚本-转载来自(博客园 桦仔)...
本文出处: 感谢桦仔 的分享精神! 很多时候我们都需要计算数据库中各个表的数据量和每行记录所占用空间 这里共享一个脚本 CREATE TABLE #tablespaceinfo ( nameinfo ...
最新文章
- Android——应用图标微技巧,系统中应用图标的适配
- 仅1年GitHub Star数翻倍,Flink 做了什么?
- C语言字符像素,返回字符串宽度 (以像素为单位)
- Python 主成分分析PCA
- 王爽 汇编语言第三版 第11章 标志寄存器
- 服务器上使用docker安装部署禅道zentao
- sun.misc.unsafe类的使用
- php算法两数之和 复杂度,每天一道leetcode算法题:两数之和-php版
- ElasticSearch中的简单查询
- 5. 什么是命名空间
- 读书笔记18:命令模式
- windows GDI开发
- Julia: 如何一次性insert Array{Any,2} to SQLite DB?
- Redis数据结构总结
- 2021年9月份最新数据库排行榜出炉
- 台式计算机用什么网卡,台式机怎样安装网卡驱动,教您电脑安装网卡驱动
- JQuery .find()方法查找
- VB编程:全局变量控件数组实例简单计算器-12
- js字符串去除空格和中文
- AIDevOps离我们有多远?
热门文章
- 最长非降子序列(动态规划dp dynamic programming)
- linux服务器每次重启卡住,运维如何解决Linux服务器重启后命令无法正常使用的问题...
- 7-3 堆中的路径 (25 分)
- idea 下划线字段转驼峰_Java如何实现数据库中表字段的下划线和驼峰式命名的Model相互转换,很方便的...-Go语言中文社区...
- sap bom递归_SAP软件之化工行业特点01
- 登录mysql时 未找到 grant命令_我在mysql数据库中可以登陆,为什么用grant命令创建用户时提示错误?...
- CMake PROJECT_BINARY_DIR和PROJECT_SOURCE_DIR区别
- WinCE6.0 修改开机Logo方法
- yii mysql 主从_mysql主从同步实践YII
- 计算机指令int,汇编入门学习笔记 (十二)—— int指令、端口