title: Getting "405 Not Allowed" after doing an Ajax post request for same domain
body: <p>I would expect this to happen for CORS but I'm literally attempting something in the same domain and I'm at a loss.</p>
  
  <p>I simple html form:</p>
  
  <pre><code>&lt;form action="" method="post" class="wpcf7-form contact-form"&gt;
              &lt;div class="contact-input-fields"&gt;
                &lt;p&gt;
                  &lt;span class="wpcf7-form-control-wrap"&gt;
                    &lt;label for="name"&gt;Name*&lt;/label&gt;
                    &lt;input type="text" id="name" name="name" value="" class="wpcf7-form-control" required=""&gt;
                  &lt;/span&gt;
                &lt;/p&gt;
                &lt;p&gt;
                  &lt;span class="wpcf7-form-control-wrap"&gt;
                    &lt;label for="email"&gt;Email*&lt;/label&gt;
                    &lt;input type="email" id="email" name="email" value="" class="wpcf7-form-control" required=""&gt;
                  &lt;/span&gt;
                &lt;/p&gt;
                &lt;p&gt;
                  &lt;span class="wpcf7-form-control-wrap"&gt;
                    &lt;label for="subject"&gt;Subject*&lt;/label&gt;
                    &lt;input type="text" id="subject" name="subject" value="" class="wpcf7-form-control" required=""&gt;
                  &lt;/span&gt;
                &lt;/p&gt;
              &lt;/div&gt;&lt;!-- /.contact-input-fields --&gt;
  
              &lt;p&gt;
                &lt;span class="wpcf7-form-control-wrap"&gt;
                  &lt;label for="message"&gt;Message*&lt;/label&gt;
                  &lt;textarea id="message" name="message" class="wpcf7-form-control" required=""&gt;&lt;/textarea&gt;
                &lt;/span&gt;
              &lt;/p&gt;
  
              &lt;p class="choose-table-form"&gt; 
                &lt;input type="submit" id="submit" value="Enviar" class="wpcf7-form-control wpcf7-submit" style="max-width:100%;"&gt; 
              &lt;/p&gt;
            &lt;/form&gt;&lt;!-- /.contact-form --&gt;
  </code></pre>
  
  <p>This is my javascript:</p>
  
  <pre><code>&lt;script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js"&gt;&lt;/script&gt;
    &lt;script type="text/javascript"&gt;
      $(function() {
          $(".success").hide();
          $("#submit").click(function() {
              var data = {
                  name: $("#name").val(),
                  email: $("#email").val(),
                  subject: $("#subject").val(),
                  message: $("#message").val()
              };
  
              $.ajax({
                  url: "forms/contactForm.php",
                  type: "POST",
                  data: data,
                  success: function(data){
                      $(".success").fadeIn(1000);
                  }
              });
          });
      });
    &lt;/script&gt;
  </code></pre>
  
  <p>and my PHP:</p>
  
  <pre><code>&lt;?php
  if($_POST){
      $name = $_POST['name'];
      $email = $_POST['email'];
      $subject = $_POST['subject'];
      $message = $_POST['message'];
      $msg = "Name: ".$name."\nEmail: ".$email."\Subject: ".$subject."\nMessage: ".$message;
  
  //send email
      mail("email@domain.com", "Message" .$email, $msg);
  }
  </code></pre>
  
  <p>I don't see anything wrong but everytime I press "submit" and trigger the ajax call I get the "405 Not Allowed".</p>
  
  <p>I've looked around at other answers here but they're mostly CORS related.</p>