$.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]<table class="result-tab" width="100%" cellspacing="0" > <tr align="center"> <td align="center"><h2 id="a-nbsp-href-javascript-nbsp-onclick-sendRequest-pid-编号-a"><a href="javascript://" onclick="sendRequest('pid');">编号</a></h2></td> <td><h2 id="a-nbsp-href-javascript-nbsp-onclick-sendRequest-pname-名-nbsp-称-a"><a href="javascript://" onclick="sendRequest('pname');">名 称</a></h2></td> <td><h2 id="a-nbsp-href-javascript-nbsp-onclick-sendRequest-pID-种-nbsp-类-a"><a href="javascript://" onclick="sendRequest('pID');">种 类</a></h2></td> <td><h2 id="a-nbsp-href-javascript-nbsp-onclick-sendRequest-pID-类-nbsp-别-a"><a href="javascript://" onclick="sendRequest('pID');">类 别</a></h2></td> <td><h2 id="a-nbsp-href-javascript-nbsp-onclick-sendRequest-pID-图-nbsp-片-a"><a href="javascript://" onclick="sendRequest('pID');">图 片</a></h2></td> <td><h2 id="a-nbsp-href-javascript-nbsp-onclick-sendRequest-pID-简-nbsp-介-a"><a href="javascript://" onclick="sendRequest('pID');">简 介</a></h2></td> <td><h2 id="a-nbsp-href-javascript-nbsp-onclick-sendRequest-pID-图-nbsp-示-a"><a href="javascript://" onclick="sendRequest('pID');">图 示</a></h2></td> <td><h2 id="a-nbsp-href-javascript-nbsp-onclick-sendRequest-pID-介-nbsp-绍-a"><a href="javascript://" onclick="sendRequest('pID');">介 绍</a></h2></td> <td><h2 id="a-nbsp-href-javascript-nbsp-onclick-sendRequest-pID-公-nbsp-司-a"><a href="javascript://" onclick="sendRequest('pID');">公 司</a></h2></td> <td><h2 id="a-nbsp-href-javascript-nbsp-onclick-sendRequest-pID-开-nbsp-始-a"><a href="javascript://" onclick="sendRequest('pID');">开 始</a></h2></td> <td><h2 id="a-nbsp-href-javascript-nbsp-onclick-sendRequest-pID-结-nbsp-束-a"><a href="javascript://" onclick="sendRequest('pID');">结 束</a></h2></td> <td><h2 id="a-nbsp-href-javascript-nbsp-onclick-sendRequest-pID-地-nbsp-址-a"><a href="javascript://" onclick="sendRequest('pID');">地 址</a></h2></td> <td><h2 id="a-nbsp-href-javascript-nbsp-onclick-sendRequest-pID-休-nbsp-息-a"><a href="javascript://" onclick="sendRequest('pID');">休 息</a></h2></td> <td><h2 id="a-nbsp-href-javascript-nbsp-onclick-sendRequest-pID-网-nbsp-址-a"><a href="javascript://" onclick="sendRequest('pID');">网 址</a></h2></td> <td><h2 id="a-nbsp-href-javascript-nbsp-onclick-sendRequest-pID-停-nbsp-止-a"><a href="javascript://" onclick="sendRequest('pID');">停 止</a></h2></td> <td><h2 id="操-nbsp-作">操 作</h2></td> <td><h2 id="排-nbsp-序">排 序</h2></td><td><h2><td><input type=button value=确认 id=bn></td></h2></td> </tr> {foreach from=$shop item=i} <tr align="center"> <td class='xh'>{$i["id"]}</td> <td>{$i["name"]}</td> <td>{$i["varietyid"]}</td> <td>{$i["classifyid"]}</td> <td>{$i["list_pic"]}</td> <td>{$i["introduction"]}</td> <td>{$i["show_pic"]}</td> <td>{$i["product_introduction"]}</td> <td>{$i["company"]}</td> <td>{$i["business_start"]}</td> <td>{$i["business_end"]}</td> <td>{$i["address"]}</td> <td>{$i["rest_flag"]}</td> <td>{$i["web"]}</td> <td>{$i["del_flag"]}</td> <td><a href="user_shop.php?id={$i["id"]}">修改</a> <a href="delete_shop.php?id={$i["id"]}">删除</a> </td> <td><a href="#" class="up">上移</a></td> <td><a href="#" class="down">下移</a></td> <td><a href="#" class="top">置顶</a></td> </tr> {/foreach} </table>
错误代码:
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: "}"
回复讨论(解决方案)
smarty 模版中有错误,导致模版编译失败。
检查下模版中代码内容。
smarty 模版中有错误,导致模版编译失败。
检查下模版中代码内容。
发的代码就是模板里的 $.post("yidong.php",{xh :r});这句 有错误 $.post("yidong.php");这样输出就没有错误 但是达不到效果啊
js 花括号与 smarty 定界符冲突问题,可以这样保护一下js代码不被编译。
{literal}
<script> <br /> ........ <br /></script>
{/literal}
其实也不必,加个空格就可以
$.post("yidong.php",{ xh :r });
或者换个定界符
使用 {literal} 标记有个坏处:js 代码终究不能有模板变量了
比较好是修改smarty的定界符。
其实也不必,加个空格就可以
$.post("yidong.php",{ xh :r });
或者换个定界符
使用 {literal} 标记有个坏处:js 代码终究不能有模板变量了
加空格不好用啊, 现在上下移动没有动作了 也没办法获取数组
比较好是修改smarty的定界符。
怎么改啊 换掉大括号么 ?
用{literal}
<script> <br /> ........ <br /></script>
{/literal}
这样,你试试可以不?

Outils d'IA chauds

Undresser.AI Undress
Application basée sur l'IA pour créer des photos de nu réalistes

AI Clothes Remover
Outil d'IA en ligne pour supprimer les vêtements des photos.

Undress AI Tool
Images de déshabillage gratuites

Clothoff.io
Dissolvant de vêtements AI

AI Hentai Generator
Générez AI Hentai gratuitement.

Article chaud

Outils chauds

Bloc-notes++7.3.1
Éditeur de code facile à utiliser et gratuit

SublimeText3 version chinoise
Version chinoise, très simple à utiliser

Envoyer Studio 13.0.1
Puissant environnement de développement intégré PHP

Dreamweaver CS6
Outils de développement Web visuel

SublimeText3 version Mac
Logiciel d'édition de code au niveau de Dieu (SublimeText3)

Laravel simplifie la gestion des données de session temporaires à l'aide de ses méthodes de flash intuitives. Ceci est parfait pour afficher de brefs messages, alertes ou notifications dans votre application. Les données ne persistent que pour la demande ultérieure par défaut: $ demande-

L'extension PHP Client URL (CURL) est un outil puissant pour les développeurs, permettant une interaction transparente avec des serveurs distants et des API REST. En tirant parti de Libcurl, une bibliothèque de transfert de fichiers multi-protocol très respectée, PHP Curl facilite Efficient Execu

Laravel fournit une syntaxe de simulation de réponse HTTP concise, simplifiant les tests d'interaction HTTP. Cette approche réduit considérablement la redondance du code tout en rendant votre simulation de test plus intuitive. L'implémentation de base fournit une variété de raccourcis de type de réponse: Utiliser illuminate \ support \ faades \ http; Http :: faux ([[ 'google.com' => 'Hello World', 'github.com' => ['foo' => 'bar'], 'forge.laravel.com' =>

Voulez-vous fournir des solutions instantanées en temps réel aux problèmes les plus pressants de vos clients? Le chat en direct vous permet d'avoir des conversations en temps réel avec les clients et de résoudre leurs problèmes instantanément. Il vous permet de fournir un service plus rapide à votre personnalité

Alipay Php ...

L'article traite de la liaison statique tardive (LSB) dans PHP, introduite dans PHP 5.3, permettant une résolution d'exécution de la méthode statique nécessite un héritage plus flexible. Problème main: LSB vs polymorphisme traditionnel; Applications pratiques de LSB et perfo potentiel

L'article examine l'ajout de fonctionnalités personnalisées aux cadres, en se concentrant sur la compréhension de l'architecture, l'identification des points d'extension et les meilleures pratiques pour l'intégration et le débogage.

L'article traite des fonctionnalités de sécurité essentielles dans les cadres pour se protéger contre les vulnérabilités, notamment la validation des entrées, l'authentification et les mises à jour régulières.
