如何更改在 htmlB 中获取 PHP 信息


how to change get php info in htmlB

我正在尝试为我的网站上的各种产品制作产品页面。到目前为止,我没有任何 php 后端。

我的网页

<div id ="itemsGohere>
//getName() getImageUrl()
//getName() getImageUrl()
//getName() getImageUrl()
</div>

我需要调用的变量

 Var productInfoString = {"images/product1.png" , "ThisProductTitle", "$50"} 

我可以制作一个 php 文件来存储这些信息,当用户点击 product1 时,它将加载 product1 的产品信息字符串吗?

是的,您需要在单击产品时执行 ajax 调用并发送其 id 并返回具有该产品值的productInfoString