title: JQuery Ajax response not working | Php
body: <p>I have a code like this</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  
  function email(){
  var myTextField = document.getElementById('email_hidden').value;
  //alert(myTextField);
  $.ajax({    
      type: "POST",
      url: "sendmail.php",
      data: "email_user="+myTextField,
      success: function(response){
      alert(response);    
  
  }
  });
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>My sendmail.php code is like this.</p>
  
  <pre><code>    &lt;?php
      $to = $_REQUEST['email_user'];
      $headers  = 'MIME-Version: 1.0' . "\r\n";
      $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
      $headers .= "From: Haan Test&lt;haan@gmail.com&gt;\r\n";
      $message_body = "Your Details";
      $subject = "Check mail";
      mail($to, $subject, $message_body, $headers);
      echo "success";
      ?&gt;
  </code></pre>
  
  <p>and my html looks like this.</p>
  
  <pre><code>   &lt;div id="email_hide"&gt;&lt;a href="#" onclick="email()" &gt;Send Email&lt;/a&gt;&lt;/div&gt;
  </code></pre>
  
  <p>I am getting the response in my firebug console as success
  but i could not alert the response. I can receive the mail also for the above jquery ajax functionality(sendmail.php)</p>
  
  <p>In other words, how to alert the response after ajax call..
  I have tried onComplete also. plz help me with this.</p>
  
  <p>My Scenerio is like this:
  User page(index1.html) >> Paypal Sandbox (for transaction) >> User page(index2.html)
  Here in index2.html, i fetch last transaction details from paypal sandbox with a send mail
  at the top right corner, so when user clicks the send mail(anchor tag) the mail should be sent via ajax jquery call.</p>
  
  <p>Thanks 
  Haan</p>