You are here
javascript调用smarty变量的方法
星期四, 2016-04-07 12:58 — shiping1
1.方法1:- {literal}
- <script type="text/javascript">
- var num = {/literal}{$number}{literal};
- </script>
- {/literal}
2.方法2:将权限相关节点数据以json或者xml的方式,传给smarty的变量。js直接使用就可以了- <script>
- var aData = <span style="color:#ff0000;">"</span>{$aData}<span style="color:#ff0000;">"</span>;
- </script>
3.数组情况:- $smarty->assign('js_arr',json_encode($arr));
- <script>
- var arr = {$js_arr};
- </script>
来自
http://blog.csdn.net/wusuopubupt/article/details/17005725