title: displaying jquery post data in a div
body: <p>Hi Im trying to learn how to do a post request using the simple example below. While I can easily post the data to result.php and get the results back via an alert message I'd like to return the results in a div on the current page instead. The reason for this is that I'd like the user to see their name appear on the screen as soon as they click on the button. Can someone tell me how I would modify this code so that the result of the post shows up in a div rather than as an alert message? Thanks</p>
  
  <pre><code>&lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"&gt;
  &lt;/script&gt;
  &lt;script&gt;
   $(document).ready(function(){
    $("#searchForm").submit(function(event){
      $.post("result.php",
       {
        name:"Mike"
  
        },
      function(data,status){
    //alert("Data: " + data + "\nStatus: " + status);
    $('#post-result').append(data);
        });
     });
    });
  &lt;/script&gt;
  
  &lt;form action="result.php" id="searchForm"&gt;
  &lt;input type="text" name="name" placeholder="Search..." /&gt;
  &lt;input type="submit" value="Search" /&gt;
  &lt;/form&gt;
  
  &lt;div id='post-result'&gt;&lt;/div&gt;
  </code></pre>