title: How to do the correct display of the template with ajax requests
body: <p>Sorry for the mistakes, I'm Russian, I used a translator.
  For practical purposes, I’m doing the admin panel supposedly for the site, it has a page of posts, users and their comments, tabbed navigation through ajax. I am writing on the Slim framework on the server. Route example:</p>
  
  <pre><code>$app-&gt;get('/panel/users', 'App\Controllers\UsersController:users');
  $app-&gt;get('/panel/user/{id}', App\Controllers\UsersController:single_user');
  
  $app-&gt;get('/panel/users/delete', 'App\Controllers\UsersController:delete_user_ajax');
  $app-&gt;get('/panel/users/delete/{id}', 'App\Controllers\UsersController:delete_user');
  
  $app-&gt;get('/panel/comments/{id}', 'App\Controllers\CommentsController:getCommentsUser');
  </code></pre>
  
  <p>And in the controller there are already requests to the database and the template is being rendered. And when you click on the corresponding menu, data is loaded via ajax.</p>
  
  <p>If I open a tab with the path to the domain / panel / users, I will get data about users without the main template, just data without html and css. What I thought of is in the controller to check the request for isXhr () and if false, then give the main admin page. But the point is not even that, I would like to know more experienced ones how to do it differently, what you can read, see what you understand, or how to do it through .htaccess? or give data differently, not through a controller? Here is the site where the link is made through <a href="http://html5.gingerhost.com/" rel="nofollow noreferrer">api history</a></p>
  
  <p>what exactly do I want to achieve, and in general understand how it is all more correct! Thanks in advance for your help.</p>