开发者

jquery ajax POST size limit?

开发者 https://www.devze.com 2022-12-08 00:52 出处:网络
I’m using jquery to send text back to my ajax.php controller like this: var dataString = \"12345678开发者_Go百科90\";

I’m using jquery to send text back to my ajax.php controller like this:

var dataString = "12345678开发者_Go百科90";      
$.post(
    '../ajax/save',
    { data: dataString },
    function(){
        alert("success");
    },
    "text");

It works well, that is until the dataString gets to be ~3500 characters long. At that upper limit (~3.5 KB), the $_POST received by ajax.php is NULL. Why?

(My php.ini post_max_size = 64M, so it’s not that.)

My setup: Apache 2.2, PHP 5.2.9, and CodeIgniter 1.7.1.


I figured it out. For some reason NetBeans' debugger tells me $_POST['data'] is null, but it's not. To manually determine the size of the $_POST received, I used these calls:

$request = http_build_query($_POST);
$size = strlen($request);

Also, I was putting $_POST['data'] into CodeIgniter's session:

$event_array = array('event' => $_POST['data']);
$this->session->set_userdata($event_array);

Which was coming up empty leading me to further believe that $_POST was empty. But the problem was instead $this->session, which apparently has a 4K size limit (according to this post).

0

精彩评论

暂无评论...
验证码 换一张
取 消