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
    Aug 2009
    Posts
    6
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Access/change variable inside lambda function

    Hey,

    In one of my functions I got the following lambda function. It works as intended, but I got a tiny problem. I'm trying to access the function-scooped variable "matched" and set it's value to "true". The problem is that it seems like the variable is existing as a local variable inside the lambda function, even if it's not declared inside the lambda function itself. So, the change "matched = true;" does not effect the variable that I declared.

    I'm not to familiar with javascript, so it's probably something I have missed. Can anyone lend me a hand?
    Thanks

    //Walle

    Code:
    //... code
    var matched = new Boolean(false);
    
    xmlhttp.onreadystatechange=function() {
    	if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
    	  document.getElementById(input_name).innerHTML = xmlhttp.responseText;
    	  if(remove_whitespace(xmlhttp.responseText) == "Available") {
    		matched = true;
    	  }
    	}
      }

  • #2
    New to the CF scene
    Join Date
    Aug 2009
    Posts
    6
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Problem solved.


  •  

    Posting Permissions

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