首页 > 解决方案 > 从 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");
});

帮助找到正确的文件路径。

标签: spring-bootthymeleaf

解决方案


推荐阅读