An array chopped off over an ajax message. Ajax placement limit?

I have a multidimensional array that consists of 426 smaller arrays that also contain 4 attributes. Below is an example of one of 426 arrays ...

    array( //Main array
          0 => array( //1 of 426 arrays
               'name' => 'Danny', 
               'email' => 'your@email.com', 
               'picture_url' => 'http://www.website.com', 
                'score' => 89
          ),
    )

I am sending this array with jquery ajax functions to a php file that adds them to the database ... My problem is that the array seems to be chopped off when it is sent to the php file. Only about half of the array actually reaches the php file ...

This led me to believe that when publishing on ajax there might be a file size limit. However, the size of my array seems relatively small.

I am running my application on WAMP ..

Can anyone shed light on what could happen?

UPDATE:

I send my array as follows:

$.ajax({
  type: "POST",
  url: "invite_friends.php",
  data: {
    theID: me.id,
    friends: multidimensional_array //This is the array <---
  },
  success: function(data, textStatus, jqXHR) {
    return console.log(data);
  },
  error: function(jqXHR, textStatus, errorThrown) {
    return alert("Error: Oops, there has been a problem");
  }
});

And I get my array (at the prompt of another .php) like this.

if($_POST['friends']) {
    $friends = $_POST['friends'];   
} else {
    $friends = FALSE;
} 
+5
4

php.ini ( ) :

max_input_vars = 1000000

max_input_vars 1000, 1000 . ( ).

PHP:

( $_GET, $_POST $_COOKIE ). , . , , E_WARNING, . .

: , " ".

, , .

+13

json .

var jsonDataString = JSON.stringify(data)
//data - array, associative array, any other variables

$.ajax({
...
    data: {
        friends: jsonDataString,
    }
...
});

json .

<?php
...
$friendsJsonString = $_POST['friends'];
$friends = json_decode($friendsJsonString);
...

php.ini - .

+4

I have the same problem.

$.ajax({data:{x:x,y:y}});

Finally, it turns out that some of the values ​​are a date format (object). When they are converted to simple types (string or integer), the problem is solved. Hope this helps.

+1
source

Try setting php_value post_max_size to at least 16M in your .htaccess and max_input_time so you don't get a timeout.

php_value post_max_size 16M
php_value max_input_time 4000
0
source

All Articles