$.post 错误怎么回事?
$.post 错误怎么回事?
$(function(){
$('#bn').click(function() {
var r = [];
$('.xh').each(function(i, t) {
r.push($(this).html());
});
alert(r);
$.post(yidong.php,{xh :r});
});
});[code=php]
编号
名 称
种 类
类 别
图 片
简 介
图 示
介 绍
公 司
开 始
结 束
地 址
休 息
网 址
停 止
操 作
排 序
{foreach from=$shop item=i}
{$i[id]}
{$i[name]}
{$i[varietyid]}
{$i[classifyid]}
{$i[list_pic]}
{$i[introduction]}
{$i[show_pic]}
{$i[product_introduction]}
{$i[company]}
{$i[business_start]}
{$i[business_end]}
{$i[address]}
{$i[rest_flag]}
{$i[web]}
{$i[del_flag]}
修改 删除
上移
下移
置顶
{/foreach}
[/code]
错误代码:
fatal error: uncaught --> smarty compiler: syntax error in template c:\wamp\www\xcx\user\templates\shop.tpl on line 154 $.post(yidong.php,{xh :r}); - unexpected :, expected one of: }
------解决思路----------------------
js 花括号与 smarty 定界符冲突问题,可以这样保护一下js代码不被编译。
{literal}
{/literal}
------解决思路----------------------
其实也不必,加个空格就可以
$.post(yidong.php,{ xh :r });
或者换个定界符
使用 {literal} 标记有个坏处:js 代码终究不能有模板变量了