Data Is Getting Lost During $.post
I have a list
- of articles
- and an event handler on a button. When clicking the button, I aggregate all
- s ID (integer) using: data.articles = $('#cat
Solution 1:
Duplicate of Array being chopped off over ajax post. Ajax posting limit? ?
Suggests that it's to do with PHP's max_input_vars: This limit applies only to each nesting level of a multi-dimensional input array.
To solve this without editing the server configuration:
// Serialize the elements into a single var using join():
data.articles = $('#category-articles').sortable('toArray').join(';');
And on the serverside:
// Unserializing the single variable back into an array:$articles = explode(';', $_POST['articles']);
The delimiting char ;
must not appear inside the elements, chose a different character if it is a problem.
Post a Comment for "Data Is Getting Lost During $.post"