title: In javascript how to send data to php file using post method
body: <p>In javascript i want to know how to send data to php file using post method. 
  I have tried diffewrent method. But i didn't get any output so please help me.
  My code is shown below.</p>
  
  <p><strong>index.php</strong></p>
  
  <pre><code>&lt;form method="post" name="form" enctype="multipart/form-data"&gt;
      &lt;input type="text" name="name" id="name" placeholder="Name" required/&gt;
      &lt;input type="email" name="email" id="email" placeholder="Email" required/&gt;
      &lt;input type="password" name="pass" id="pass" placeholder="Password" required/&gt;
      &lt;input type="submit" name="submit" value="Send" onclick="myFunction()"/&gt;
  &lt;/form&gt;
  
  &lt;script&gt;
      function myFunction() {
          var name = document.getElementById("name").value;
          var email = document.getElementById("email").value;
          var password = document.getElementById("password").value;
          ////  I want post the values to profile.php
      }
  &lt;/script&gt;
  </code></pre>
  
  <p><strong>profile.php</strong></p>
  
  <pre><code>if (isset($_POST['submit'])) {
      $name = $_POST['name']; 
  }
  </code></pre>