Was writing a script on Email Validation using AJAX in PHP and in result I got an error:
Uncaught RangeError: Maximum call stack size exceeded at RegExp.test () at Object. (jquery.min.js:2) at Function.each (jquery.min.js:2) at jt (jquery.min.js:2) at jt (jquery.min.js:2) at jt (jquery.min.js:2) at jt (jquery.min.js:2) at Function.w.param (jquery.min.js:2) at Function.ajax (jquery.min.js:2) at (index):194
What I am trying is:
<input type="text" placeholder="Email"  id="Email" oninput="this.className = ''" name="email" required>
$(document).ready(function() {
  var email = document.getElementById("Email");
  $(email).on('keyup input', function() {
    if (email) {
      $.ajax({
        type: 'post',
        url: 'ajax_email_validation.php',
        data: {
          email: email,
        },
        success: function(response) {
          $('#email_status').html(response);
          if (response == "OK") {
            $(':button[type="button"]').prop('disabled', false);
            return true;
          } else {
            $(':button[type="button"]').prop('disabled', true);
            return false;
          }
        }
      });
    } else {
      $('#email_status').html("");
      return false;
    }
  });
});
After reading comments, I tried:
var email = document.getElementById( "Email" );
$(document).ready(function() {
 $(email).on('keyup input', function(){ 
  $.ajax({
  type: 'post',
  url: 'ajax_email_validation.php',
  data: {
   email:email,
  },
  success: function (response) {
   $( '#email_status' ).html(response);
   if(response=="OK")   
   {
    $(':button[type="button"]').prop('disabled', false);
    //return true;  
   }
   else
   {
    $(':button[type="button"]').prop('disabled', true);
    return false;   
   }
  }
  });
});
});
I am not getting any error also there is no message of response...
