I am trying to make a script that updates the captcha image, that is loaded through live() function… It works, but it only updates the image 1 time on firefox, 2 times on safari… How can I make this to work multiple times?
jquery 1.4.2
relevant part of code:
/* captcha image change */
var rand = Math.random();
$('a.captcha_refresh').live('click', function() {
$('img.captcha').attr("src", 'captchashow.php?sid=' + rand);
});
thanks,
brm
This depends on your implementation, but you are reusing the same random value on all request. You may want:
That way
randkeeps changing, but you see its latest value.