'jQuery ajax POST returns 500 Internal Server Error
I am trying to perform this ajax post but for some reasons I am getting 500 internal server error.
<?php
while ($row = $query_row->fetch()) {
$id_row = $row['id'];
echo '$.ajax({
url: "post.php",
data: { from: from_date, to: to_date, user_id: user_id },
type: "POST",
dataType: "json",
success: function (data) {';
$total_return = $query_column->rowCount();
while ($column = $query_column->fetch()) {
$id_column = $column['id'];
echo '$("#td_content_'.$id_row.'_'.$id_column.'").html(data.value_'.$id_row.'_'.$id_column.');';
}
echo '}
});';
}
?>
The code above works just fine for $total_return <= 10 (no matter SELECT * FROM table_name WHERE id BETWEEN 1 AND 10 or BETWEEN 101 AND 110). If I increase the $total_return to more than 10, the code starts returning error 500 Internal Server Error.
This is not maxJsonLength problem because I also have another ajax post (outside of the while ($query_row->fetch()) at the end of the page which works fine with $total_return = 104.
Solution: I found the solution of my question here: https://talk.plesk.com/threads/mod_security-error-response-body-too-large.350523/
To fix the issue, try to add the following lines in Domains > domain.com > Apache & nginx Settings > Additional directives for HTTP:
<IfModule mod_security2.c>
SecResponseBodyLimit 546870912
</IfModule>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
