How to show data to the user using PHP?
<p>I'm always trying to find new methods on development. So I looked into some websites and analyzed their ways of presentation.</p>

<ol>
<li><p>Returning part of the page using AJAX</p>

<p>Normally I will use an array  to return values, for example:</p>

<pre><code> //GET User details

 $user_id = $_POST['user_id'];

 $user_details = $this-&gt;get_user($user_id);

 if ($user_details['status'] == true) {
     exit(json_encode(array('status'=&gt;true, 'data'=&gt;$user_details['data'])));
 } else {
     exit(json_encode(array('status'=&gt;false, 'reason'=&gt;'SomeReasons....')));
 } 
</code></pre></li>
</ol>

<p>But I see that some sites returning `HTML'. Is this preferable in any reason?</p>

<p>Also what is the best method to use: <code>AJAX</code> or an <code>iframe</code>?</p>
