简体   繁体   English

jQuery AJAX不向服务器发布完整数组

[英]jQuery AJAX Not POSTing Full Array to Server

I have a farily large multidimensional Javascript array which I'm passing to my PHP file with an AJAX POST as such: 我有一个很大的多维Javascript数组,它通过AJAX POST传递到我的PHP文件中,如下所示:

$.ajax({
    type: "POST",
    dataType: 'json',
    url: "forms/scripts/testArray.php",
    data: {
        header: header,
        gridData: gridData
    }
});

gridData is my multidimensional array which has 1000 elements with each of their child arrays containing 3 elements. gridData是我的多维数组,具有1000个元素,其每个子数组包含3个元素。 When I debug and look at the data in my PHP file, there are only about 350 elements from the array that arrived from the POST . 当我调试并查看PHP文件中的数据时,数组中只有大约350个元素是从POST到达的。

Using Firebug, I get this info about File Size Sent and File Size Received: 使用Firebug,我得到有关已发送文件大小和已接收文件大小的信息:

开机自检问题

As you can see, the little pop-up is telling me the AJAX call sent 462.8 KB but only 4.9 KB was actually received. 如您所见,弹出的小窗口告诉我AJAX呼叫发送了462.8 KB,但实际上仅接收到4.9 KB。 Is this true? 这是真的? Is that why I'm only getting part of the array I'm attempting to POST? 这就是为什么我只参与尝试发布的数组的原因吗?

Also, is this the best way to move a multidimensional array from Javascript to PHP via an AJAX POST? 另外,这是通过AJAX POST将多维数组从Javascript移到PHP的最佳方法吗?

I appreciate any help you can offer! 感谢您提供的任何帮助!

Probably, something in the toolchain is limiting the maximum amount of stuff that can be sent/received. 工具链中的某些内容可能会限制可以发送/接收的最大内容数量。 This can either by in your webserver (Apache probably), or (more likely) in your PHP settings. 这可以在您的网络服务器(可能是Apache)中,也可以(在可能的情况下)在您的PHP设置中。 PHP has some settings like post_max_size, max_input_time, max_input_nesting_level, max_input_vars, etcetera. PHP具有一些设置,例如post_max_size,max_input_time,max_input_nesting_level,max_input_vars等。 You should check out these settings! 您应该检查这些设置!

在“被接收”的最后一个元素上或紧随其后的json编码/解码中,数据中可能存在一个奇怪的字符。

Remove ; 删除; (semicolon) in php.ini file, set increase max_input_vars then it works: (分号)在php.ini文件中,设置增加max_input_vars工作:

max_input_vars = 10000

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM