title: Load PHP page content without page refresh
body: <p>I am trying to load content from a PHP page when user clicks on a link:</p>
  
  <p>The user can click the link to get the AJAX data in the file: <code>message.php</code></p>
  
  <p>I currently have this code in <code>message.php</code></p>
  
  <pre><code>            $('#pmid&lt;?php echo $convoData['id']; ?&gt;').click(function(){
                    $.ajax({
                      type:"GET", //this is the default
                      url: "/index.php?i=pm&amp;p=rr",
                      data: {id:"&lt;?php echo $convoData['id']; ?&gt;"}
                    })
                    .done(function( stuff ) {
                    $( "#name" ).html( stuff ); 
                    $( "#post" ).html( otherstuff );
                    $( "")
                    });
                });
  </code></pre>
  
  <p>And the HTML:</p>
  
  <pre><code>    Chat with &lt;span id="name"&gt;&lt;/span&gt; //The $name should be added to here
      &lt;ul id="post"&gt;&lt;/ul&gt; //The $post should be added to here
  </code></pre>
  
  <p>The page where the AJAX is getting the data from is named: get.php, it looks like this:</p>
  
  <pre><code>    $id = $_GET['id'];
      $get=mysql_query("SELECT * FROM private_messages WHERE id='$id'");
      $getData=mysql_fetch_assoc($get);
  
  
      //Set the variables that needs to be send back to the other page.
      $getUser=$user-&gt;getUserData($getData['sender_id']);
  
  
      $name=$getUser['username'];
      $post = '
      &lt;li&gt;
        &lt;img width="30" height="30" src="images/avatar-male.jpg"&gt;
        &lt;div class="bubble"&gt;
          &lt;a class="user-name" href=""&gt;'.$name.'&lt;/a&gt;
          &lt;p class="message"&gt;
            '.$getData['subject'].'
          &lt;/p&gt;
          &lt;p class="time"&gt;
  
          &lt;/p&gt;
        &lt;/div&gt;
      &lt;/li&gt;
      ';
  echo $name;
  echo $post;
  </code></pre>
  
  <p>So, the problem is that currently all the data is just being printed in <code>#name</code></p>
  
  <p>How can I do so the <code>$name</code> will get printed in <code>#name</code> and the <code>$post</code> in <code>#post</code>?</p>