title: jQuery get response from php file after posting
body: <p>I'm posting some data to a php file with jquery. The PHP file just saves the data and prints the success of fail message. I would like to get the message generated by php file and embed in a div. I'm unable to figure out how i can return the message from PHP file.</p>
  
  <p>Here is my code:</p>
  
  <p><strong>jQuery:</strong></p>
  
  <pre><code>$(document).ready(function(){
  
      $('#submit').click(function() {
  
          $.ajax({
              type : 'POST',
              url : 'post.php',           
              data: {
                  email : $('#email').val(),
                  url   : $('#url').val(),
                  name  : $('#name').val()
              },          
          });     
      });
  });
  </code></pre>
  
  <p><strong>PHP:</strong></p>
  
  <pre><code>&lt;?php
  //save data
  $message = "saved successfully"
  ?&gt;
  </code></pre>