duanlu7680 2018-10-12 16:59
浏览 63

jQuery .load()未正确加载视图的一部分

I'm working inside Fat-Free-Framework, using the F3 Template Language, but I've come across an issue I'm not sure how to solve.

I've got a portion of a webpage, which contains data from a database that needs to be updated at some interval to make sure the person looking at the page is looking at up-to-date information.

I can easily load the data this way:

<div id="container">
    <include href="module/views/table_pending.htm"/>
</div>

This works, but it doesn't update at an interval. I know I need to use jQuery for this, so I tried to use the load() method to load this page fraction, but it isn't rendering properly.

This is my Javascript

function loadPageContents() {
    $('#container').load('{{@BASE}}/app/modules/module/views/table_pending.htm');
}
loadPageContents();

Here is a minimal version of my table_pending.htm:

<repeat group="{{ @data }}" value="{{ @device }}">
    {{ @device[uid] }}<br>
</repeat>

When using F3's include element, my page renders as expected:

enter image description here

But when using jQuery .load(), it seems that F3's template language isn't really parsed at all (thus variables not being replaced, loop not working properly etc):

So my question is, how can I include this page fragment into my main page, update it on an interval, and still render my template language?

enter image description here

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 一直显示正在等待HID—ISP
    • ¥15 Python turtle 画图
    • ¥15 关于大棚监测的pcb板设计
    • ¥15 stm32开发clion时遇到的编译问题
    • ¥15 lna设计 源简并电感型共源放大器
    • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
    • ¥15 Vue3地图和异步函数使用
    • ¥15 C++ yoloV5改写遇到的问题
    • ¥20 win11修改中文用户名路径
    • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入