当前页面的网址是http://localhost:8080/operator/list.html
。在这个页面中的Ajax应该是http://localhost:8080/operator/somerequest.html
如果ctx = "http://localhost:8080/operator/"
然后ajax会工作,但我想用百里香内置符号替换它,所以如何做到这一点?我曾尝试var ctx = [[${#httpServletRequest.getContextPath()}]]
和var ctx = [[@{/}]]
甚至和这个两个人,但没有...如何获得百里香的url路径
<script th:inline="javascript">
/*<![CDATA[*/
var ctx = ?; // what thymeleaf annotation
/*]]>*/
</script>
我已阅读this。