如何在jquery中打印prestashop全局变量的值

如何在jquery中打印prestashop全局变量的值,prestashop,Prestashop,我想在javascript文件中获取prestashop主题文件夹url?我在javascript文件中使用了prestashop全局变量,但出现了一些错误: jQuerydocument.readyfunction{ jQueryclick-me-web-service.clickfunction{ var folder_url={$tpl_dir};//我在这一行遇到了问题 jQuery.ajax{ 方法:邮寄, 网址:, 数据:{名字:Joh,姓氏:Sin,用户名:johsin,电子邮件

我想在javascript文件中获取prestashop主题文件夹url?我在javascript文件中使用了prestashop全局变量,但出现了一些错误:

jQuerydocument.readyfunction{ jQueryclick-me-web-service.clickfunction{ var folder_url={$tpl_dir};//我在这一行遇到了问题 jQuery.ajax{ 方法:邮寄, 网址:, 数据:{名字:Joh,姓氏:Sin,用户名:johsin,电子邮件:john12@gmail.com } } .donefunction msg{ 警报数据保存:+msg; }; }
}; 始终使用{literal}{/literal}包装JS代码,以避免在Smarty和JS中使用}时发生冲突

要将smarty变量插入到一个文字化变量中?区域,执行相反的操作:

{literal}{$tpl_dir}{literal}
这将临时打开smarty标记并允许您使用smarty变量