title: livevalidation.js custom username check function
body: <p>I am sure this is probably something simple that i am not doing.  Running livevalidation.js jquery plugin (livevalidation.com). It provides for custom function callbacks.  I am trying to check for username availability.  The server side is working fine and I am getting the proper responses back in my data var...</p>
  
  <p>Here is my JS:</p>
  
  <pre><code>Validate.Username = function(value, paramsObj) {
      var paramsObj = paramsObj || {};
      var message = paramsObj.failureMessage || "Username is not available";
      var isSuccess = true;
  
      $.post("&lt;?php echo fURL::getDomain(); ?&gt;/ajax/username", 
          function(data) {
              if (data.status === 'notavailable')
              {
              Validation.fail('oops, not available.');
              }               
              });
  };
  </code></pre>
  
  <p>I am calling it using:</p>
  
  <pre><code>var username = new LiveValidation('username', { validMessage: curr_username + "is available!" });
  username.add( Validate.Presence, { failureMessage: "Choose a username" });
  username.add( Validate.Username, { failureMessage: "Username is not available." } );
  </code></pre>
  
  <p>The problem I am getting is:</p>
  
  <pre><code>Uncaught ReferenceError: Validation is not defined
  </code></pre>
  
  <p>If I put the <code>Validation.fail()</code> outside of my <code>.post()</code> function it works fine. So am pretty sure it is because it's not able to be referenced inside the <code>.post()</code> function.</p>
  
  <p>I've tried using a callback function</p>
  
  <pre><code>if (data.status === 'notavailable')
  {
      status_not_available();
  }
  </code></pre>
  
  <p>I get the same error.</p>
  
  <p>I realize this is something probably extremely simple, but any help would be appreciated. Thank you in advance.</p>