为了账号安全,请及时绑定邮箱和手机立即绑定

页面本身没错,加上ajax代码后错了

页面本身没错,加上ajax代码后错了

错过了年华 2017-10-13 21:35:31
   <div class="theme-options">                                         <div class="cart-title number">数量</div>                                         <dd>                                         <input id="min" class="am-btn am-btn-default" name="" type="button" value="-" />                                         <input id="text_box" name="" type="text" value="1" style="width:30px;" />                                         <input id="add" class="am-btn am-btn-default" name="" type="button" value="+" />                                         <span id="Stock" class="tb-hidden">库存<span class="stock">1000</span>件</span>                                         </dd>                                     </div>                                     <div class="clear"></div>                                     <div class="btn-op">                                         <div class="btn am-btn am-btn-warning">确认</div>                                         <div class="btn close am-btn am-btn-warning">取消</div>                                     </div>                                 </div>                                 <div class="theme-signin-right">                                     <div class="img-info"> <img src="images/songzi.jpg" /> </div>                                     <div class="text-info"> <span class="J_Price price-now">¥39.00</span> <span id="Stock" class="tb-hidden">库存<span class="stock">1000</span>件</span> </div>                                 </div>                             </form>                         </div>                     </div>                 </dl>                 <div class="clear"></div>                 <!--活动    -->                               </div>             <div class="pay">                 <div class="pay-opt"> <a href="home2.html"><span class="am-icon-home am-icon-fw">首页</span></a> <a><span class="am-icon-heart am-icon-fw">收藏</span></a> </div>                 <li>                     <div class="clearfix tb-btn tb-btn-buy theme-login"> <a id="LikBuy" title="点此按钮到下一步确认购买信息" href="#">立即购买</a> </div>                 </li>                 <li>                     <div class="clearfix tb-btn tb-btn-basket theme-login"> <a id="LikBasket" title="加入购物车" href="javascript:addCart({$rst[0]['g_id']})"><i></i>加入购物车</a> </div>                 </li>             </div>         </div>         <div class="clear"></div>     </div>     <script type="text/javascript">           function addCart(g_id){               var url = "addCart.php";               var data = {"g_id":g_id,"s_num":parseInt($("#text_box").val())};               var success= function(response){                                  }               $.post(url,data,success,"json");           }     </script>
查看完整描述

2 回答

已采纳
?
HalfAnHour

TA贡献52条经验 获得超73个赞

我觉得吧,是你用了smarty模板的原因。{}里面的代码被smarty解析了出现了问题,{literal}<script>......</script>{/literal}看是否可行。

查看完整回答
反对 回复 2017-10-14
?
Developer_Zuck

TA贡献112条经验 获得超42个赞

错误说在你的176行,能把代码发完整点吗?

查看完整回答
反对 回复 2017-10-14
  • 2 回答
  • 0 关注
  • 1684 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信