spring-boot - 从 javascript 访问 html 模板
问题描述
我需要从 js 脚本加载 html 模板。项目使用 SpringBoot 和 Thymeleaf。
我试过了:
$(document).ready(function() {
$("#app").load("src/main/resources/templates/fragments/loginFragment.html");
});
$(document).ready(function() {
$("#app").load("../../templates/fragments/loginFragment.html");
});
$(document).ready(function() {
$("#app").load("fragments/loginFragment.html");
});
帮助找到正确的文件路径。
解决方案
推荐阅读
- javascript - 结合 vegalite 中传说的形状和颜色
- python - 使用 Python 从列表中删除多个字典值
- python - anaconda tensorflow ImportError:DLL加载失败
- javascript - 如何在 php 中更新 xml 属性中的 JSON 字符串
- react-native - FCM API 返回成功响应,但推送通知未发送给用户
- d3.js - dc.js TextFilterWidget 未定义
- python - 我应该默认使用原始字符串吗?
- python - 二十一点问题:以下代码不运行 else 语句,而是再次迭代 elif 条件
- swift - RxSwift 在可调试性方面的技术限制是什么?
- javascript - 如何在单击按钮时删除附加的 div?