I tried researching on Google and I browsed through some question here. I tried some of the solutions but I can't get them to work.
<td>
<img id="captcha" src="captcha.php" name="captcha" />
<img src="refresh.jpg" width="25" alt="" id="refresh_captcha" name="refresh_captcha" />
<input type="text" name="txtCaptcha" id="txtCaptcha" size="10" />
</td>
The code below doesn't work:
$('.refresh_captcha').click(function(){
$('img').attr('src', 'captcha.php?cache=' + new Date().getTime());
});
I also tried this:
$("#refresh_captcha").click(function() {
$("#captcha").attr("src","captcha.php?r=" + Math.random());
});
And this as well:
jQuery(function($) {
jQuery('#captcha').after("<a href=\"#\" id=\"refresh_captcha\">Refresh<\/a>");
jQuery('body').delegate('#refresh_captcha','click',function(){
jQuery.ajax({
'success':function(html){
jQuery("#captcha").attr("src",html)
},
'url':'/captcha.php?refresh=1',
'cache':false
});
return false;
});
});
Anyone can help me?