gpt4 book ai didi

php - 如何使用 jquery load() 和 zend 框架加载 html 文件?

转载 作者:行者123 更新时间:2023-11-30 18:12:45 24 4
gpt4 key购买 nike

我有一个 jquery ajax 函数,类似于:

$(".content").load("test-content.phtml", function() {
//some logic
});

和我的 zend 框架模块:

content
- controllers
- TestController.php
- public function testContentAction(){}
- views
- scripts
- test
- test-content.phtml

我的问题是如何告诉 load() 函数 test-content.phtml 从哪里加载内容。

我是否必须从我的 Controller 调用 content/test/test-content 函数?

此外,我知道框架中有一个 AjaxContext 帮助程序,但我需要使用 ajax 加载此文件。

有什么想法可以解决这个问题吗?

最佳答案

该 .phtml 文件应由 Controller 呈现,然后您的加载函数应将操作 url 作为参数。

$(".content").load("url/to/controllerAction");

关于php - 如何使用 jquery load() 和 zend 框架加载 html 文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14162953/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com