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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T04:00:05+00:00 2026-06-13T04:00:05+00:00

Possible Duplicate: jquery ajax return: undefined I have written the following code to check

  • 0

Possible Duplicate:
jquery ajax return: undefined

I have written the following code to check email already exists or not using jquery and jquery validate.Jquery is used for email format validation.
I have called ****check-email.php** file in jquery function.even though there emailaddress is present in my db,the action is get called and it directs to dashboard page.Actually it should not direct to next page because email is already exists.My **”return false;” in jquery function has no effect.It goes to next page even if it is present in db. I am not getting where I am wrong ???

here is my code

index.html:-

<form name="mysignupform" id="mysignupform" class="form-horizontal"  action="Dashboard" method="post">
  <div class="control-group">
    <label class="control-label" for="inputEmail" >Email</label>
    <div class="controls">
      <input type="text" name="email" id="inputEmail"  placeholder="Email" >
    </div>
  </div>
  <br/>
  <div class="control-group">

    <label class="control-label" for="inputPassword" >Password</label>

 <div class="controls">

 <input class="password" type="password" name="password" id="inputPassword" placeholder="Password">


    </div>

    </div>


    <div class="controls">
      <input type="hidden" id="body" name="body" value=""></input>
    </div>

  <div class="control-group">
    <div class="controls">

      <button type="submit" name="submit" id="signupsubmit"class="btn btn-inverse" onsubmit="return function(e)">Go to Dashboard</button>
    </div>
  </div>

</form>

my jquery function:-

<script>
         $(document).ready(function(){ //newly added 

           $('#signupsubmit').click(function() 

         {
             alert('in');

             var emailVal = $('#inputEmail').val(); // assuming this is a input text field

             alert(emailVal);
             $.post('check-email.php', {'email' : emailVal}, function(data) {

             if(data=='true') return false;
             else $('#mysignupform').submit();

          });

       });

    });
</script>

my check-email.php:-

 $con = mysql_connect("localhost","root","");

   if (!$con)
  {
     die('Could not connect: ' . mysql_error());
  }
       mysql_select_db("mojiva", $con);

       $sql = "SELECT email FROM user_info WHERE email =".$_POST['email'];

       $select = mysql_query($sql,$con);

       $row = mysql_num_rows($select);

            if ($row > 0)  
          {
            echo 'true';  
          }
             else 
          {
             echo 'false';
          }

?>

I tried true false in jquery function immediate after $(‘#signupsubmit’).click(function() this function at this time return true works.but when post is get called it does not have any effect of return false.

  • 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-06-13T04:00:07+00:00Added an answer on June 13, 2026 at 4:00 am

    It’s probably because the return false is not referring to the form but the click event.

    On the form:

    <form name="mysignupform" id="mysignupform" class="form-horizontal"  action="Dashboard" method="post" onsubmit="email_check($('#inputEmail').val())" >
    

    Then for JQuery:

    <script>
             $(document).ready(function(){ //newly added 
    
              function check_email(emailVal){ 
    
             {
                 alert('in');
    
                 alert(emailVal);
                 $.post('check-email.php', {'email' : emailVal}, function(data) {
    
                 if(data=='true') return false;
                 else return true;
    
              });
    
         }
        });
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: return AJAX callback return I have made a JQuery code using AJAX,
Possible Duplicate: jQuery: Return data after ajax call success I have the following function
Possible Duplicate: submit form does not stop in jquery ajax call I have a
Possible Duplicate: jQuery ajax return value I have this jQuery script: $('#headerSubmit').click(function() { var
Possible Duplicate: jQuery AJAX submit form I have a form on a page A,
Possible Duplicate: jQuery won't parse my JSON from AJAX query So I have parsed
Possible Duplicate: Bind multiple events to jQuery 'live' method I have the following function:
Possible Duplicate: jquery/ajax load new content when available i have a table named news
Possible Duplicate: Wait until all jquery ajax request are done? I have an array
Possible Duplicate: jQuery Ajax always returns “undefined”? I'm trying to come up with a

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.