Ajax sending _POST without max character

2

In this ajax the post sends more than 1000 caracters:

$.ajax({
            url: 'inserir.php',
            type: 'POST',
            data: { inseason: document.getElementById('comment').value },
            success: function(result) {
                alert('the request was successfully sent to the server');
            }
        });

But this one has a maximum of 1000 characters and I can not figure out why.

var http = new XMLHttpRequest();

        var parametros = "inseason=" + document.getElementById('comment').value;

        http.open("POST", "inserir.php", true);

        http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");

        http.onreadystatechange = function() {
            if(http.readyState == 4 && http.status == 200) 
            {

                //console.log(http.responseText);
                $('#logs').text(http.responseText);

            }
        }
        http.send(parametros);
    
asked by anonymous 11.11.2017 / 20:12

1 answer

1

The error I had was that it passed & in the post and ajax confused it as another parameter and the parameter I wanted to receive the text only showed me the characters up to & .

Then I realized the error and DvD told me how to solve it:

escape(document.getElementById('comment').value)

Just change this in the parameters.

    
12.11.2017 / 03:00