當前頁面的網址是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。