JSFiddle - React, Tailwind, and code Playground

HTML

<input type="text" name="MyText" value="" />

JavaScript

jQuery(document).ready(function() {
    $('input[name="MyText"]').keypress(function(e) {
        if (e.which == 13 && !e.shiftKey) {
            $text = $(this).val();
            alert('am ajuns aici'+$text);
            $.post("path/to/handler.php", {text: $text}, function(e) {
                alert("success");
            });
        }
    });
});