看来Firefox和IE正在缓存图像。为防止这种情况,请将时间戳记附加到URL和图像源:
在Javascript中,您可以使用
new Date().getTime():
$("#captchaSection").load("captcha_p.php?" + new Date().getTime());在PHP中,您可以使用
microtime():
< img src="captcha.php?<?php echo microtime(); ?>" name="imgCaptcha" />
我看不到使用
.load()加载包含图像的HTML的任何好处。仅更改
src图像的属性会更容易,例如:
// refresh captcha$('img[name=imgCaptcha]').prop('src', 'captcha.php?' + new Date().getTime());


