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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T16:50:41+00:00 2026-05-22T16:50:41+00:00

I have a simple form validation with ajax and jquery. I’ve done this before

  • 0

I have a simple form validation with ajax and jquery. I’ve done this before but now it seems to be failing over and over.

The title is the error I see in the firebug console. After some google research, seems to be a problem with managing windows but… I’m not trying to do that and I also tried in other browsers with identical results. The form submits…

This is the function:

$("#login-da").submit(function(){
        $('#error').hide();
        var username = $('#username').val();
        var password = $('#password').val(); 
        var query = 'username=' + username + '&pass=' + password;
        $.ajax({
            type: "POST",
            url: "functions/check-user.php",
            async: false,
            data: query,
            cache: false,
            success: function(response){
                        if(response == 0) {                         
                            $('#error').slideDown();
                            var error = 1;
                        }
                        else {
                            var error = 0;
                        }
                    }
        });
        if (error == 1){        
            return false;
        }
    });

I’ve tried to return false directly in the success function with identical results. The error begins to show but the form submits anyways and nothing appear.
I’ve also noticed through debugging that anything outside the ajax call isn’t executed.

Any help would be really appreciated

  • 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-22T16:50:42+00:00Added an answer on May 22, 2026 at 4:50 pm

    Try using Number() on the response data, also, check the scope of the error variable on the response funcion:

    success: function (response) {
        var result = Number(response);
        if (result == 0) {
            $('#error').slideDown();
            error = 1;
        } else {
            error = 0;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Have a simple form (only extract fields here) but for some reason the JQserilization
I have a simple form like this: <form name=serachForm method=post action=/home/search> <input type=text name=searchText
Say I have this simple form: class ContactForm(forms.Form): first_name = forms.CharField(required=True) last_name = forms.CharField(required=True)
I have a simple HTML form that uses uses ajax in part of the
I have a simple cakephp form WITH validation that submits to a database. It
I have a simple form with a few required field validators and a validation
I am looking for validation using jquery on a simple form and I want
Built a simple JQuery/Ajax newsletter signup form, then went back after the fact to
Hi I'm trying to create a simple registration form with ajax validation. I've got
I have form where before i was using simple post with <button name=submit id=register

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.