title: $.ajax() not working [jquery]
body: <p>Hey I've seen all the solutions here on StackOverflow on the topic but they seem to not work, I don't know why. I've this code inside the <code>$(form).submit(function(e){...});</code> event handler.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>        e.preventDefault();
    let formData = new FormData();
    formData.append('username', username.value);
    formData.append('password', password.value);
    
    $.ajax({
     url: 'login.php',
     type: 'POST',
     data: formData,
     processData: false,
     contentType: false,
     success: function(response) {
      console.log(response);
     },
     error: function() {
      console.log('fail');
     }
    })</code></pre>
  </div>
  </div>
  </p>
  
  <p>By the look of things, I think the login.php is receiving the formData value because when I submit the form nothing happens.</p>
  
  <p>This is the login.php</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;?php
   session_start();
   $password = $username = '';
   $_SESSION['user'] = '';
  
  
   if($_SERVER['REQUEST_METHOD'] == 'POST') {
    if(isset($_POST['login'])) {
     include_once('db.php');
     $username = strip_tags($_POST['username']);
     $passd = strip_tags($_POST['password']);
  
     $passd = md5($password);
  
     $sql = "select * from users where username = '" . $username . "' limit 1";
     $query = mysql_query($sql);
  
     if($query) {
      $row = mysql_fetch_assoc($query);
      $dbpass = $row['password'];
      if($password == $dbpass) {;
       $_SESSION['user'] = $username;
       header('Location: admin.php');
      } else {
       echo 'Wrong username or password!';
      }
     } else {
      echo mysql_error();
     }
    }
   }
  ?&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>How do I make this work? Thank you in advance.</p>