简体   繁体   English

使用jQuery替换图像

[英]Image replacing using jquery

I have used GD library function to color my images using coordinates marked with the help of jquery editor. 我已经使用GD库功能使用在jquery编辑器的帮助下标记的坐标为我的图像着色。 the problem i am facing is all these coloring in done using ajax on the same image which needs to displayed on the page. 我面临的问题是在页面上需要显示的同一图像上使用ajax完成所有这些着色。 And i have replaced the image of that particular div using jquery. 而且我已经使用jquery替换了该特定div的图像。

$('.Plot_left img').attr("src" , "<?php echo $mapimage_path .'?timestamp='.strtotime(date('y-m-d h:m:d'));?>");

Even though i have appended timestamp in the image src iam not able to see the output at the first load. 即使我在图像src中附加了时间戳,我也无法在第一次加载时看到输出。 I need to refresh multiple times to see the desired output. 我需要刷新多次才能看到所需的输出。

Is there any other solution for this. 还有其他解决方案吗?

Double quotes(") wont escape single quotes (') but vice versa is possible, so try this way 双引号(“)不会转义单引号('),但反之亦然,因此请尝试这种方式

$('.Plot_left img').attr("src" , '<?php echo $mapimage_path ."?timestamp=".strtotime(date("ymd h:m:d"));?>');

Happy Coding :) 快乐编码:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM