title: How to Prevent URL redirection on Form Submission if the process.php is on a different domain
body: <p>Greetings everyone! </p>
  
  <p>I need help with this code. For example, I have two websites: <strong>firstwebsite.com</strong> and <strong>secondwebsite.com</strong> </p>
  
  <p>My form is on <strong>firstwebsite.com</strong> and the data are processed on the process.php of <strong>secondwebsite.com</strong> </p>
  
  <p>What is happening is when someone submits the form in <strong>firstwebsite.com</strong> , the web page is redirected to a webpage in <strong>secondwebsite.com</strong></p>
  
  <p>What <strong>I want to happen</strong> is </p>
  
  <ol>
  <li><p>to stop the form submission from redirecting to the web page of <strong>secondwebsite.com</strong></p></li>
  <li><p>instead of redirecting, a dialog box should appear telling the user that form have been submitted, thus the current form still remains on the page of <strong>firstwebsite.com</strong></p></li>
  </ol>
  
  <p>I've been looking for answers and I've tried several codes but none work.</p>
  
  <p>Please paste the entire code or script or ajax that I should use.</p>
  
  <pre><code>&lt;html&gt;
  
   &lt;head&gt;
      &lt;title&gt;document&lt;/title&gt;
    &lt;body&gt;
      &lt;div id="mydiv"&gt;
        &lt;form name="sampleform" action="secondwebsite.com/process.php" method="POST"&gt;
        &lt;p&gt;&lt;input type="text" name="phone"/&gt;&lt;/p&gt;
        &lt;div id="phone-status"&gt;&lt;/div&gt;
        &lt;p&gt;&lt;input type="text" name="fname"&gt;&lt;/p&gt;
        &lt;textarea name="text" id="text"&gt;&lt;/textarea&gt;
        &lt;p&gt;&lt;input type="submit" name="SubmitForm" value="SEND"&gt;&lt;/p&gt;
     &lt;/div&gt;
    &lt;/body&gt;
   &lt;/head&gt;
  &lt;/html&gt;
  </code></pre>