Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any size limitation for ajax post?

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?

My js looks like that

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
                });
            }
        }
    });
};
like image 853
The Coder Avatar asked Oct 05 '11 07:10

The Coder


4 Answers

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.

What kind of server do you use?

like image 152
yoprogramo Avatar answered Oct 29 '22 02:10

yoprogramo


There isn't any size limitation for POSTs in 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.

Check what you actually receive on the server end, so you know if you've got a problem with the code or the database.

like image 29
kufi Avatar answered Oct 29 '22 00:10

kufi


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

This may be helpful:

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

like image 41
dexter.ba Avatar answered Oct 29 '22 01:10

dexter.ba


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

like image 39
riffraff Avatar answered Oct 29 '22 00:10

riffraff