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 3806696
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T14:52:29+00:00 2026-05-19T14:52:29+00:00

I warn you now very little experience at jquery. My question is this. I

  • 0

I warn you now very little experience at jquery. My question is this. I have a username and password form. I have Jquery that accesses a php page looks into the database matches the password and user name then echos “yes” or no based off if the input is right then takes me to the next page. Now since this Jquery works on submit I can’t figure out how to add a javascript captcha correctly to the page because it wont verify the word. So I’m wondering how to alter or add to this code so that I can first verify the word using javascript then the jquery below. Any help would be appreciated thanks.

<script language="javascript">
    $(document).ready(function()
    {
        $("#login_form").submit(function()
        {
            //remove all the class add the messagebox classes and start fading
            $("#msgbox").removeClass().addClass('messagebox').text('Validating....').fadeIn(1000);
            //check the username exists or not from ajax
        $.post("ajax_login.php",{ user_name:$('#username').val(),password:$('#password').val(),rand:Math.random() } ,function(data)
            {
              if(data=='yes') //if correct login detail
              {
                $("#msgbox").fadeTo(200,0.1,function()  //start fading the messagebox
                { 
                  //add message and change the class of the box and start fading
                  $(this).html('Logging in.....').addClass('messageboxok').fadeTo(900,1,
                  function()
                  { 
                     //redirect to secure page
                     document.location='edujob.php';
                  });
                });
              }
              else 
              {
                $("#msgbox").fadeTo(200,0.1,function() //start fading the messagebox
                { 
                  //add message and change the class of the box and start fading
                  $(this).html('incorrect').addClass('messageboxerror').fadeTo(900,1);
                });     
              }

            });
            return false; //not to post the  form physically
        });
        //now call the ajax also focus move from 

    });
    </script>
  • 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-19T14:52:30+00:00Added an answer on May 19, 2026 at 2:52 pm

    Client-side captcha is useless because it can be by-passed by the end-user. I’d recommend you to use a captcha library. For instance, reCAPTCHA is a very simple and strong server-side library maintained by Google which is easy to implement (reCAPTCHA PHP Docs).

    Once it is implemented, I’d change the javascript ajax call with this:

    $.ajax({
      url: "ajax_login.php",
      type: "text",
      dataType: "string",
      data: $("#login_form").serialize(),
      success: function(data) {
        if(data === "yes") {
          // DO SOMETHING
        } else {
          // DO SOMETHING
    
          // Reload reCAPTCHA
          if(typeof Recaptcha === "object") {
            Recaptcha.reload();
          }
    
        }
      }
    });
    

    That’s what I think is the best solution.

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

Sidebar

Related Questions

I will warn you up front, this question borders on silly, but I'm asking
Does gettext have a way to warn me about strings that have not been
Just need a little bit of Javascript to warn people that press the back
I have to warn you: the question may be rather silly, but I can't
I have a working Action and JSP form that I'm using for creating new
There is a pattern that happens every now and then. I have a method
You may have noticed that we now show an edit summary on Community Wiki
I have developed a CakePHP application that I have now deployed to my production
I must warn you, this code will hurt your eyes, so please don't judge
I have come across many articles which warn against using links to provide logout

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.