如何在智能模板中显示json数据?

I'm using smarty and php for my website. There is some code which converts the data into json. I want to use that data in a smarty template. That data is a set of error messages and I want to display those messages in a assigned smarty template at desired ID. I'm not able to get that in smarty template. Actually what is happening is the error messages are displayed on a plain page instead in the desired tag. Following is my smarty and PHP code: Following is the smarty code where I want to display the error messages:

if $error_msg}<div class="error-info">{$error_msg.error_msgs}</div>{/if}

Now following is my PHP code:

<?php
if($request['form_submitted']=='yes') {
                $ret = $objPracticeSheet->InsertPracticeSheet($request, $practice_sheet_error_messages);
                if(!$ret) { 
                    $error_msg  = $objPracticeSheet->GetAllErrors();
                    $data = array();
                    $data['error_message'] = $error_msg['error_msgs'];
                    $data = json_encode($data);
                    echo $data;
                    die;
                } else {
                    $data = array();
                    $data['success_message'] = "success";
                    $data = json_encode($data);
                    echo $data;
                    die;
                }
            } else { 

                $all_subjects = $objSubjectsTopicsQues->GetAllSubjectsHavingTopics();
                $smarty->assign('all_subjects', $all_subjects);
                $smarty->assign('sheet_type', 'practice');
                $bread_crumbs_text = 'Add Practice Sheet';
                $submit_value      = 'Submit';
                $cancel_value      = 'Cancel';
                $file_to_show      = 'manage-practice-sheet.tpl';
            }
$smarty->assign("op", $op);
    $smarty->assign("query_string", $query_string);
    $smarty->assign("bread_crumbs_text", $bread_crumbs_text);
    $smarty->assign("submit_value", $submit_value);
    $smarty->assign("cancel_value", $cancel_value);
  $smarty->assign("error_msg", $error_msg);
  $smarty->assign("file_to_show", $file_to_show);
  /*$smarty->assign('create', '-active');
  $smarty->assign("sub_menu_file", "epn-create-sub-menu.tpl");
  $smarty->assign('practice_sheet', '-active');*/
  $smarty->assign('practice_sheet', 'active');
  $smarty->assign('prepare', 'selected');
  $smarty->display("index.tpl");
?>

Can you help me in displaying the error messages json data in the above div? Thanks in advance. I'm also attaching the screenshot of the current output.enter image description here

Use JavaScript to parse the JSON, then put the errors in the div.

To make this easier, let's give your div an id:

<div id="error-info-main" class="error-info"></div>

Then

<script>
{literal}
(function() {
    var error_json = {/literal}{$error_msg.error_msgs}{literal};
    var errors = JSON.parse(error_json);
    document.getElementById('error-info-main').innerHTML = errors.error_message;
}());
{/literal}
</script>

Alternatively, you could just the pass the message itself from PHP:

$smarty->assign("error_msg", $error_msg->error_message);

This may not be 100% correct, as I don't have your data to test with, but I believe that's right. You get the idea at any rate.