AJAX does not return anything from the database

0

I need to check if the data already exists in the database and only gives the warning if it already exists, otherwise nothing happens. Only onBlur is not working.

PHP

<input name="placa" id="placa" type="text" value="" pattern="[A-Za-z]{3}[0-9]{4}" size="20" maxlength="7" required onBlur="verifExists()" onkeyup="this.value = this.value.toUpperCase();">
<div class="style12" id="jaexistedv" style="display:none">Placa j&aacute; registrada!</div>

JAVASCRIPT

<script type="application/javascript">
            function verifExists() {
                var ajax = new XMLHttpRequest();
                var registro = document.getElementById("placa");
                ajax.open("GET", "incluir_rs.php" + registro, true);
                ajax.send();
                ajax.onreadystatechange = function() {
                if (ajax.readyState == 4 && ajax.status == 200) {
                var data = ajax.responseText;
                    if (data == "registro") {
                      document.getElementById("jaexistedv").style = "display:show";
                     } else {
                        document.getElementById("jaexistedv").style = "display:none";
                     }
                }
                }
            }
        </script>
    
asked by anonymous 28.05.2018 / 13:40

0 answers