AJAX Call in MVC Structure PHP
<p>I have an AJAX featured page with dynamic components. I was wondering about how to handle an ajax call in MVC. </p>

<p>The first idea I had was to create a new controller for ajax calls without rendering views and check in the routing for an ajax request like this</p>

<pre><code>if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) &amp;&amp; strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
  call_user_func_array(array("ajax", $this-&gt;url_action), null);
}
</code></pre>