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

时间:2022-08-25 02:08:44

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>

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

1 个解决方案

#1


1  

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.

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

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.

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

#1


1  

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.

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

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.

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