<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>
语法错误,仔细找找,老师这种php和html混合编写的方式并不推荐,一般来说如果用模板引擎的话,可以直接去缓存内查看生成的html代码哪里错了