Refreshing Captcha with coldfusion
Hello
I am trying to write a refresh for cfcaptcha. I got it from cfjedi blog and I can't get it to work. I have tried a number of different senarios of this code and even rewrote some of it. The image does not appear, I had it flashing in and then it would disappear so that wasn't a solution. I am adding my code.. I am hoping someone can help me get this to work.
showcaptcha.cfm page:
<cffunction name="makeRandomString" returnType="string" output="false">
<cfset var chars = "23456789ABCDEFGHJKMNPQRS">
<cfset var length = randRange(4,7)>
<cfset var result = "">
<cfset var i = "">
<cfset var char = "">
<cfscript>
for(i=1; i <= length; i++) {
char = mid(chars, randRange(1, len(chars)),1);
result&=char;
}
</cfscript>
<cfreturn result>
</cffunction>
<cfset captcha = makeRandomString()>
<cfimage action="captcha" width="300" height="55" text="#captcha#" fonts="verdana,arial" difficulty ="medium">
Contact.cfm page
<script>
$(document).ready(function() {
$("#captchaDiv").load("showcaptcha.cfm #captchaDiv");
$("#reloadLink").click(function(e) {
$("#captchaDiv").load("chowcaptcha.cfm #captchaDiv");
e.preventDefault();
});
})
</script>
<cfoutput>
<cfform action="#cgi.script_name#" method="post" class="mail" id="formID" enctype="application/x-www-form-urlencoded" preloader="true">
<cfinput name="name" type="text" value="#form.name#" id="name" placeholder="*Name" />
<!--- the rest of my inputs are all here --->
<div id="captchaDiv" style="width:300px; height:55px; margin-top:10px;"> </div>
<span>Can't read?</span> <a href="" id="reloadLink">Reload</a><br />
<span>ENTER SECURITY CODE</span>
<cfinput type="text" name="captcha" style="margin-top:20px; margin-left:-142px;">
<cfinput type="submit" name="submit" value="Submit" class="more_button"/>
</cfform>
</cfoutput>
Can anyone help me out with this issue?
