0

嗨,我开始使用 web2py。我有一个带有 div: 的页面 web Test.html 。另一方面,我在同一文件夹中有一个网页网页:Test2.html,其中包含一些 Python 代码:

{{items = ['a', 'b', 'c']}}
{{i=1}}
<table>
{{for item in items:}} 
    <tr>
        <td></br>SOME CONTENT</td>
    </tr>
{{i=i+1}}
{{pass}}
</table>

如何将 Test2.html 内容放入 div IDtest 中?有什么例子吗?谢谢。目标是学习如何在 IDtest 中插入动态表。我的意思是,我会在按下按钮后刷新 IDtest 内容......

最后一次测试:我已经测试过了

<script src="{{=URL('static', 'js/jquery.js')}}" type="text/javascript"></script> ... and then <script type="text/javascript">jQuery(document).ready(function() { setInterval(function() {var url ='{{=URL('Test2.html')}}'; jQuery('#IDtest').load(url);alert("HELLO");}, 5000); }); I can see the HELLO evrey 5 seconds but nothing in div... any sugestions?

我可以每 5 秒看到一次 HELLO,但没有发生与 div 相关的任何事情......似乎负载不起作用......有什么解决方案吗?我在网上读到负载在服务器端工作,但我不知道如何在 web2py 中翻译它?

4

1 回答 1

1

期望您已加载 Jquery 库:

$('#IDtest').load('Test2.html');
于 2012-12-17T14:54:57.070 回答