Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6251959
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T13:42:34+00:00 2026-05-24T13:42:34+00:00

I am sure this is probably something simple that i am not doing. Running

  • 0

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…

Here is my JS:

Validate.Username = function(value, paramsObj) {
    var paramsObj = paramsObj || {};
    var message = paramsObj.failureMessage || "Username is not available";
    var isSuccess = true;

    $.post("<?php echo fURL::getDomain(); ?>/ajax/username", 
        function(data) {
            if (data.status === 'notavailable')
            {
            Validation.fail('oops, not available.');
            }               
            });
};

I am calling it using:

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." } );

The problem I am getting is:

Uncaught ReferenceError: Validation is not defined

If I put the Validation.fail() outside of my .post() function it works fine. So am pretty sure it is because it’s not able to be referenced inside the .post() function.

I’ve tried using a callback function

if (data.status === 'notavailable')
{
    status_not_available();
}

I get the same error.

I realize this is something probably extremely simple, but any help would be appreciated. Thank you in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T13:42:35+00:00Added an answer on May 24, 2026 at 1:42 pm

    i am having the same issue.
    Ive found the following, http://forum.jquery.com/topic/ajax-return-value-on-success-or-error-with-livevalidation but have not been able to get it working.
    BUT YES! At this very moment i made som (crappy) javascript addon that made it behave, i think 🙂

    This is what i use.

    
            function check_avail(name, id, postUrl)
        {
           var dataVal = name+'='+$(id).val();
           var isaccepted = ''
           $(id).next('div').remove();
    
           $(id).after("

    Undersøger om "+name+" er ledigt

    "); $.ajax({ url: postUrl, cache: false, type: 'post', dataType: 'json', data: dataVal, async: false, success: function(data) { if( data.success == 'true' ) { $('#'+name+'-availability').remove(); //return false; isaccepted = false; } if( data.success == 'false' ) { $('#'+name+'-availability').remove(); // name.destroy(); isaccepted = true; } } }); if (isaccepted == false) { return false; } else{ return true }; }

    And

    
        f1.add( Validate.Custom, { against: function() {
         return check_avail( 'brugernavn', '#ft001', 'usernamecheck.asp' ); 
        }, failureMessage: 'Brugernavnet er optaget' } );
    
    

    Hope it helps you 🙂
    The json query you can read about on the link in the begining 🙂
    (I am not at all skilled at javascript, and the “isaccepted” solution could problalby be made a lot better)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know this probably really simple but Im not sure what im doing wrong...
I'm sure there's a clean way to do this, but I'm probably not using
Im sure this will be a simple one but have a project that started
Not sure this is possible, but looking to write a script that would return
I am sorry if this is a simple fix (I'm sure it probably is)
This is probably something simple, but I can't seem to find the answer. I
I'm not sure I'm doing this the right way, so I'm open to other
This is probably something very simple but I'm looking for the optimal way of
This is probably something simple but I am tearing my hair out at the
I am not sure if I am doing this right. I have a list

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.