title: Laravel Ajax does not get the value from the form to Controller
body: <p>In Ajax code I have <code>action = 'contact';</code>, contact is used in route file:</p>
  
  <pre><code>Route::post('contact', array('uses' =&gt; 'FormsController@send', 'as' =&gt; 'post_form'));
  </code></pre>
  
  <p>In route file I have <code>FormsController@send</code> it is file php to send email:</p>
  
  <pre><code>$name = Input::get('name');
  
  $getSubject = "Subject of my email";
  $myEmail = 'myEmail@gmail.com';
  
  $uid = md5(uniqid(time()));
  $eol = "\r\n";
  
  // header
  $header = "From: " . $name . " &lt;" . $email . "&gt;\r\n";
  $header .= "MIME-Version: 1.0" . $eol;
  $header .= "Content-Type: multipart/mixed; boundary=\"" . $uid . "\"" . $eol;
  $header .= "Content-Transfer-Encoding: 7bit" . $eol;
  $header .= "This is a MIME encoded message." . $eol;
  
  // message &amp; attachment
  $nmessage = "--" . $uid . "\r\n";
  $nmessage .= "Content-Type: text/plain; charset=\"iso-8859-1\"" . $eol;
  $nmessage .= "Content-Transfer-Encoding: 8bit" . $eol;
  if($name != ''){$nmessage .= "Name: " . $name . "\r\n\r\n";}
  
  
  // $nmessage .= "Wiadomość:\r\n" . $getMessage . "\r\n\r\n";
  $nmessage .= "--" . $uid . "\r\n";
  $nmessage .= "Content-Transfer-Encoding: base64\r\n";
  $nmessage .= "--" . $uid . "--";
  
  $send = mail($myEmail, $getSubject, $nmessage, $header);
  </code></pre>
  
  <p>Ajax directs to the controller file and bypasses the form, so the controller file does not download any data from the form, and the mail can not be sent. I have no idea how to pass data from the form to the controller file.</p>
  
  <p>My Ajax:</p>
  
  <pre><code>    const sendForm = function () {
          action = 'contact';
  
          if (window.XMLHttpRequest) {
              xmlhttp = new XMLHttpRequest();
          } else {
              xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
          }
  
          xmlhttp.open('post', action, true);                
          xmlhttp.onreadystatechange = function () {
              if (this.readyState === 4 &amp;&amp; this.status === 200) {
                  const getMessageSend = document.querySelector("#messageSend");
                  getMessageSend.innerText = "Thank you for sending an email. You will receive an answer shortly.";
              } else {
                  const getMessageSendError = document.querySelector("#messageSendError");
                  getMessageSendError.innerText = "An error occurred and the email was not sent.";
              }
          };
  
          // xmlhttp.open("post", action, true);
          // xmlhttp.send();
  
          const token = document.querySelector('meta[name="csrf-token"]').content;
  
          xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
          xmlhttp.setRequestHeader('X-CSRF-TOKEN', token);
          xmlhttp.send();
  
      };
  
      const sendMail = function() {
  
          options.form.addEventListener('submit', function (e) {
              e.preventDefault();
              let validate = true;
              const elementsRequired = document.querySelectorAll(":scope [formHr]");
  
              [].forEach.call(elementsRequired, function(element) {
                  const type = element.type.toUpperCase();
  
                  if (type === 'TEXT') {
                      if (!validateText(element)) {validate = false;}
                  }
  
              });
              if (validate) {
                  sendForm();
                  // this.submit();
              } else {
                  return false;
              }
  
          });
  
      };
  </code></pre>
  
  <p>My form:</p>
  
  <pre><code>{!! Form::open(['action'=&gt;['FormsController@send'], 'method' =&gt; 'post', 'class' =&gt; 'form', 'novalidate' =&gt; 'novalidate', 'files' =&gt; true]) !!}
  
   &lt;input type="text" name="name" placeholder="Name"  formHr&gt;
  
  {!! Form::submit('Send', ['class' =&gt; 'submit-btn']); !!}
  {!! Form::close() !!}
  </code></pre>