title: jQuery AJAX Posting values to another page in PHP
body: <p>I am trying to post values to another page in jquery ajax and php<br></p>
  
  <p>This is my <strong>form</strong> in page1.php.</p>
  
  <pre><code>&lt;form method="post" action="page1.php"&gt;
       Name : &lt;input type="text" id="N_Txt"&gt;
       Email : &lt;input type="text" id="Email_Txt"&gt;
       &lt;input type="button" id="Sub_Btn" value="button"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>This is my AJAX in <strong>page1.php</strong></p>
  
  <pre><code>$(document).ready(function() {
       $('#Sub_Btn').click(function() {
           var nm = $('#N_Txt').val();
           var email = $('#Email_Txt').val(); 
           $.ajax({
               type:"POST",
               url:"page2.php",
               data:{ nm : nm , email : email },
               success:function(resp){
                  console.log('success ajax');
               },
               error:function(resp){
                  console.log('error ajax');
               }
           });
       });
  });
  </code></pre>
  
  <p>This is my <strong>page2.php</strong></p>
  
  <pre><code>&lt;?php
     echo $_POST['nm'];
     echo $_POST['email'];
  ?&gt;
  </code></pre>
  
  <p>Control is not even going to page2.php. How do i do it? I dont want to send values through query string window.location. 
  Thanks</p>