Php 如何在jquery中交换图像
我有我的网站,用户可以交换三种产品,每种产品都有图像,因此,我不想每次用户单击按钮时都调用ajax,我只想在html中显示图像URL,在需要时无需抓取。。例如,这里是我的htmlPhp 如何在jquery中交换图像,php,javascript,jquery,Php,Javascript,Jquery,我有我的网站,用户可以交换三种产品,每种产品都有图像,因此,我不想每次用户单击按钮时都调用ajax,我只想在html中显示图像URL,在需要时无需抓取。。例如,这里是我的html <img src="<?php print $product[$selected_product]['product_image']; ?>" width="auto" height="199" alt="" /> </div> <p style="display:no
<img src="<?php print $product[$selected_product]['product_image']; ?>" width="auto" height="199" alt="" />
</div>
<p style="display:none;" class="image_<?php print $product["standard"]['product_id']; ?>"><?php echo $product["standard"]['product_image']; ?></p>
<p style="display:none;" class="image_<?php print $product["professional"]['product_id']; ?>"><?php echo $product["professional"]['product_image']; ?></p>
<p style="display:none;" class="image_<?php print $product["premium"]['product_id']; ?>"><?php echo $product["premium"]['product_image']; ?></p>
但问题是console.log正确地打印出了图像url,但有时当我单击图像时,它并没有改变,并且我得到了这个错误
Image corrupt or truncated: http://posnation.com/shop_possystems/image/data/1B.png
一种更清晰的方法是呈现三个
标记,并设置它们的CSS,使它们相互重叠。然后使用jQuery的show/hide函数来显示相应的函数。已经有很多了。
Image corrupt or truncated: http://posnation.com/shop_possystems/image/data/1B.png