如何使用js将{%include%}附加到html?

2024-04-20 01:39:58 发布

您现在位置:Python中文网/ 问答频道 /正文

我希望在home.html模板中包含post.html模板,为此,我使用jquery将{% include "post.html" %}附加到home.html模板中

问题是它出现在home.html类似{% include "post.html" %}的内容中,而没有被评估为实际的post.html内容,这就是我想要使用的问题:

$('body').append('{%include "post.html"%}')

要将post.html添加到home.html,但在home.html中,我得到的只是:

<!--home.html-->
{%include "post.html"%}

我所期望的是:

<!--home.html-->
<div>actual content of post.html</div>