在 OpenCart 中通过 AJAX 加载产品内容

发布于 2024-08-28 04:55:58 字数 103 浏览 3 评论 0原文

使用 OpenCart 如何将类别产品显示为通过 AJAX 从 MySQL 数据库加载的内容?然后该内容将显示在

Using OpenCart how would I show a categories products as content loaded via AJAX from a MySQL database? This content would be then shown inside a <div>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

哎呦我呸! 2024-09-04 04:55:58

启动 MooToolsjQuery 并使用他们的 AJAX 支持。在每个类别链接上放置一个 onclick 处理程序,该处理程序调用从服务器获取类别数据的函数。它可以是原始 html,然后您可以用它替换其中的内容。

服务器端脚本将生成显示产品信息所需的 html。由于您要将其插入到现有页面内的 div 中,因此不需要页眉/页脚,只需核心产品数据。

Fire up MooTools or jQuery and use their AJAX support. Put an onclick handler on each category link, which calls a function that fetches the category data from the server. It can be raw html, which you then replace the contents of that with.

The server-side script would generate JUST the html necessary to display the product info. Since you'll be inserting it into a div inside an existent page, there's no need for headers/footers, just the core product data.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文