Javascript ajax 帖子有大小限制吗?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7658193/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Is there any size limitation for ajax post?
提问by The Coder
I'm posting ckeditor content via Ajax to php. But getting 4-5 sentence of posted material in my db table. I wonder, Is there any size limitation for ajax post? is there any way to post big text contents via ajax?
我正在通过 Ajax 将 ckeditor 内容发布到 php。但是在我的数据库表中得到 4-5 句已发布的材料。我想知道,ajax 帖子有大小限制吗?有没有办法通过ajax发布大文本内容?
My js looks like that
我的js看起来像那样
function postViaAjax(autosaveMode) {
var name = $("#name").val();
var title = $("#title").val();
var menu = $("#menu").val();
var parentcheck = $(".parentcheck:checked").val();
var id = $("#id").val();
if (parentcheck == 0) {
var parent = parentcheck;
} else {
var parent = $("#parent").val();
}
var content = CKEDITOR.instances['content'].getData();
var dataString = 'name=' + name + '&title=' + title + '&menu=' + menu + '&parentcheck=' + parentcheck + '&id=' + id + '&parent=' + parent + '&content=' + content;
$.ajax({
type: "POST",
url: "processor/dbadd.php",
data: dataString,
dataType: "json",
success: function (result, status, xResponse) {
var message = result.msg;
var err = result.err;
var now = new Date();
if (message != null) {
if (autosaveMode) {
$('#submit_btn').attr({
'value': 'Yadda saxlan?ld? ' + now.getHours() + ':' + now.getMinutes() + ':' + now.getSeconds()
});
} else {
$.notifyBar({
cls: "success",
html: message + ' ' + now.getHours() + ':' + now.getMinutes() + ':' + now.getSeconds()
});
}
}
if (err != null) {
$.notifyBar({
cls: "error",
html: err
});
}
}
});
};
采纳答案by yoprogramo
The HTTP specification doesn't impose a specific size limit for posts. They will usually be limited by either the web server or the programming technology used to process the form submission.
HTTP 规范没有对帖子强加特定的大小限制。它们通常会受到 Web 服务器或用于处理表单提交的编程技术的限制。
What kind of server do you use?
你使用什么样的服务器?
回答by kufi
There isn't any size limitation for POSTs in HTTP.
HTTP 中的 POST 没有任何大小限制。
Maybe you have an & in your content variable. Then everything after that would be stripped after that.
也许你的内容变量中有一个 & 。然后之后的所有内容都将被剥离。
Other than that what type do you use for your data column in the database? Is it, by any chance, something like varchar(1000)? Then anything bigger would also get stripped.
除此之外,您对数据库中的数据列使用什么类型?是不是有点像 varchar(1000) 之类的东西?然后任何更大的东西也会被剥离。
Check what you actually receive on the server end, so you know if you've got a problem with the code or the database.
检查您在服务器端实际收到的内容,以便您知道代码或数据库是否有问题。
回答by dexter.ba
You have a limitation on the Apache server. Look for LimitRequestBody directive.
您对 Apache 服务器有限制。查找 LimitRequestBody 指令。
This may be helpful:
这可能会有所帮助:
回答by riffraff
In theory the limits on AJAX requests are the same on all the other requests, so it depends on your web server/app setup. See also Max length of send() data param on XMLHttpRequest Post
理论上,AJAX 请求的限制与所有其他请求相同,因此这取决于您的 Web 服务器/应用程序设置。另请参阅XMLHttpRequest Post 上最大长度的 send() 数据参数