title: Is a good idea use template function in my site that retrieve HTML generated with PHP Smarty and display with ajax response?
body: <p>My PHP framework</p>
  
  <pre><code>public static function insertAction(){
  
     .......
  
     \MVCApplication::getSmarty()-&gt;display('common/inserted.tpl');
  
  }
  </code></pre>
  
  <p>Show to user using Ajax response: (JQuery)</p>
  
  <pre><code>success: function(response){
      $("body").html(response);
  }
  </code></pre>
  
  <p>I want to make a site where all actions don't refresh the page (i.e., I want a dynamic site with just one page index.php).</p>
  
  <p>My question is about security! I've read some articles on the web about the concern around script injection and my fear is that any malicious guy intercepts the response from the server and adds bad code to my server response! How do I improve my framework security? </p>
  
  <p>(Eventually I will need execute script in my .tpl smarty templates and this will be outputted to ajax response too...)</p>