0

While looking at the console I am getting this error:

index.php:199 Uncaught TypeError: $.ajax is not a function
at checkemail (index.php:199)
at HTMLInputElement.onkeyup (index.php:232)

Though I have added the jquery library on my page:

function checkemail() {
  var email = document.getElementById("Email").value;

  if (email) {
    $.ajax({
      type: 'post',
      url: 'check_data.php',
      data: {
        email: email,
      },
      success: function(response) {
        $('#email_status').html(response);
        if (response == "OK") {
          return true;
        } else {
          return false;
        }
      }
    });
  } else {
    $('#email_status').html("");
    return false;
  }
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<p>
  <input type="email" placeholder="Email" id="Email" onkeyup="checkemail();" oninput="this.className = ''" name="email" required>
  <span id="email_status"></span>
</p>
Rory McCrossan
  • 306,214
  • 37
  • 269
  • 303
user10670473
  • 65
  • 1
  • 7

0 Answers0