Everything works fine, except one thing. When I write something in the inputbox, first it passes and being echoed correctly for one moment, then the last few characters/digits disappear. For example if I am writing: Hello The PHP echo Hello, then, after a moment the word becomes H or Hell The number of disappeared characters depends on the speed of typing the word, as much as I write quickly as much as characters disappear. When I write very slowly, letter by letter, the word being echoed correctly and nothing changes. Here is the code for reference:
HTML:
<input name="paramA" id="paramA" type="text" class="form-control" maxlength="5" required/>
jQuery:
$("#paramA").on("keyup", function () {
    var paramB = $('#paramB').val();
    var paramA = $('#paramA').val();
    var spaced = $.trim($(this).val());
    if ( !$(this).val() || $(this).val() !== spaced) {
        $("#result").html("");
    } else {
        $.post( 'http://localhost/folder/code.php',    
                {'paramB':paramB,'paramA':paramA}, 
                function(data) {
                    $("#result").html(data);
                }
        );
    }
}); 
PHP:
echo $_POST["paramA"];
Any help will be appreciated.
 
     
     
    