如何将数据从PHP传输到Smarty?

I have a project that uses Smarty files, but i don't understand how are they parsed from PHP to tpl. I understand that from tpl files to PHP are parsed with js that uses AJAX. And please share some good AJAX guides, i mostly find people using this nonsense to parse PHP data to javascript

<script type="text/javascript">
          var a = <?php echo json_encode($var); ?>;
         </script>

To parse data to smarty template I needed to parse the variable in data array or in some modules parse object_data['data'] array