JSFiddle - React, Tailwind, and code Playground
HTML
<input type="text" id="userinput" name="userinput"/>
<button onclick="inputhandler()">TEST</button>
<script>
function inputhandler() {
var text = document.getElementById('userinput').value;
alert(text);
/*DRAGONS BE HERE*/
/*THEN*/
/*USE AJAX HERE TO PASS THE RESULTS TO PHP SCRIPT*/
}
</script>