What's wrong with $.post?
What's wrong with $.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]
Number |
Name |
Kinds |
Category |
Picture |
Introduction |
Diagram |
Introduced |
Company |
Start |
End |
Address |
Seating |
Url |
Stop |
Operation |
Sort |
|
|
{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"]} |
Modify Delete |
Move Up |
Move Down |
Top |
{/foreach}
[/code]
Error code:
Fatal error:uncaught-Smarty compiler:syntax error in template ' C:\wamp\www\xcx\user\templates\shop.tpl ' on line 1 "$.post" ("yidong.php", {xh:r}); "-Unexpected": ", expected one of:"} "<--thrown in C:\wamp\www\xcx\libs\sysplugin s\smarty_internal_templatecompilerbase.php on line 154
------to solve the idea----------------------
JS Curly braces and Smarty delimiter conflict, you can protect the JS code is not compiled.
{literal}
{/literal}
------to solve the idea----------------------
In fact, you don't have to, just add a space.
$.post ("yidong.php", {xh:r});
or a different delimiter.
There is a downside to using {literal} tags: JS code cannot have a template variable after all