Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Apr 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Help changing image source!!!!!

    Why doesn't this work?

    This is my HTML:
    Code:
    <cfoutput>
    <img src="/img/captcha-image.cfm?hash=#request.hashReference.hash#" alt="Captcha Image" border="0" id="image"/>
    <button type="button" onClick="refresh()">Refresh</button>
    <cfoutput>
    Javascript:
    Code:
    function refresh()
    {	
    	var hashRef = '';
    	
    	
    	$.ajax({
    		type: "GET",  
    		async: true,
    		dataType: "html",
      		url: "some url", 
      		
      		success: function(data){
        		
    			hashRef=data;
    			alert(hashRef);
    			
    			
    		},
    		error: function(a,b,c) {
    			alert(b);
    						
    		}
    	}); 
    	
    	
    	
    		document.getElementById('image').src='/img/captcha-image.cfm?hash=hashRef';	
    	
    			
    }
    Last edited by aknbad23; 04-14-2011 at 04:30 PM.

  • #2
    New to the CF scene
    Join Date
    Apr 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Nevermind....got it.

    Code:
    document.getElementById('image').src='/img/captcha-image.cfm?hash=' + hashRef;


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •