Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/284.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何在jquery中交换图像_Php_Javascript_Jquery - Fatal编程技术网

Php 如何在jquery中交换图像

Php 如何在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

我有我的网站,用户可以交换三种产品,每种产品都有图像,因此,我不想每次用户单击按钮时都调用ajax,我只想在html中显示图像URL,在需要时无需抓取。。例如,这里是我的html

    <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