Reputation: 5463
how to refresh the Yii captcha word image when validation failed ? here's my code
jQuery.ajax({
type : "POST",
cache : false,
url : emailfrienddata,
data : 'friendemail='+friendemail+'&sendername='+sendername+'&friendemailcontent='+friendemailcontent+"&captcha="+captcha,
success :function(data){
if(data == 1){
alert('Email Sent');
jQuery.fancybox.close();
} else if(data == 2) {
alert('wrong captcha!');
//HOW TO REFRESH YII CAPTCHA IN THIS AREA ?
return false;
}
}
});
return false;
}
Upvotes: 0
Views: 1239
Reputation: 8607
You can trigger a click on the refresh button. If you put the captcha in a container with class captcha
you could:
$(".captcha a").trigger("click");
Upvotes: 1