ajax post是否有大小限制?

时间:2021-08-01 22:17:49

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向php发布ckeditor内容。但是在我的数据库表中,我得到了4-5句的内容。不知ajax post是否有尺寸限制?有什么方法可以通过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
                });
            }
        }
    });
};

4 个解决方案

#1


7  

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?

你使用哪种服务器?

#2


4  

There isn't any size limitation for POSTs in HTTP.

HTTP中的帖子没有任何大小限制。

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.

检查服务器端实际接收到的内容,这样您就知道代码或数据库是否有问题。

#3


2  

You have a limitation on the Apache server. Look for LimitRequestBody directive.

您对Apache服务器有一个限制。寻找LimitRequestBody指令。

This may be helpful:

这可能是有用的:

http://gallery.menalto.com/node/14870

http://gallery.menalto.com/node/14870

#4


2  

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()数据参数的最大长度

#1


7  

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?

你使用哪种服务器?

#2


4  

There isn't any size limitation for POSTs in HTTP.

HTTP中的帖子没有任何大小限制。

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.

检查服务器端实际接收到的内容,这样您就知道代码或数据库是否有问题。

#3


2  

You have a limitation on the Apache server. Look for LimitRequestBody directive.

您对Apache服务器有一个限制。寻找LimitRequestBody指令。

This may be helpful:

这可能是有用的:

http://gallery.menalto.com/node/14870

http://gallery.menalto.com/node/14870

#4


2  

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()数据参数的最大长度