thymleaf js判断不等于0出错
来源:7-5 redis预减库存,rabbitmq异步下单

慕慕1546623
2018-07-26
只要加上 resultId< 0 页面就错误了.看了下typeof resultId 类型是number.
网上查有可能是HTML5强类型报错,加了配置也没用.
实在是找不到问题了,求老师解决.
if (resultId < 0) {
layer.msg("对不起,秒杀失败");
} else if (resultId == 0) {
setTimeout(function () {
getMiaoshaRsult(goodsId);
}, 50)
} else {
layer.confirm("恭喜你秒杀成功!查看订单?", {btn: ["确定", "取消"]},
function () {
window.location.href = "/order_detail.html?orderId=" + resultId;
}, function () {
layer.closeAll();
});
}
下面是报错信息:
2018-07-26 01:56:43.522 ERROR 34852 --- [nio-8080-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.thymeleaf.exceptions.TemplateInputException: Exception parsing document: template="goods_detail", line 112 - column 35] with root cause
2回答
-
若鱼1919
2018-07-26
用/* <![CDATA[ */ 和 /* ]]> */把js代码包起来即可,如下:
<script type="text/javascript" th:inline="javascript">
/* <![CDATA[ */
for(var i=1;i<3;i++){
alert(i);
}
/* ]]> */
</script>
022018-07-27 -
若鱼1919
2018-07-26
加QQ远程下吧
012018-07-26
相似问题