I'm trying to post large amounts of text via $.post in jQuery and getting a 406 response. It works fine under around 300 characters. Below is my code: 
index.php
html
<form class="formss" action="index.php">
    <textarea id="submittts" name="tts" spellcheck="false"></textarea>
</form>
jQuery
$('.save').click(function() {
    $.post('store.php', $('.formss').serialize())
});
store.php
<?php
$tts = $_POST['tts'];
$texttostore = $tts;
$servername = "localhost";
$username = "xxx";
$password = "xxx";
$dbname = "notes";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
} 
$sql = "INSERT INTO notes (code)
VALUES ('$texttostore')";
if ($conn->query($sql) === TRUE) {
    echo stripslashes(str_replace('\r\n',PHP_EOL,$texttostore));
} else {
    echo "Error: " . $sql . "<br>" . $conn->error;
}
$conn->close();
?>
.htaccess
<IfModule mod_security.c>
SecFilterCheckURLEncoding Off
</IfModule>
Getting the following response: https://i.stack.imgur.com/MUZpX.png
Have also tried with a local form submit, but it would also bring up a bad request.
Note: All whitespace and formatting is preserved when stored, and that is intentional
If anyone could help me out that would be great, thanks :)
 
     
    