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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T06:54:15+00:00 2026-06-13T06:54:15+00:00

why return false; or event.preDefualt(); doesn’t work after $.post(); Firstly,I simply written a return

  • 0

why “return false;” or “event.preDefualt();” doesn’t work after $.post();
Firstly,I simply written a return false after
$(#id).submit(function(e){ return false;}// it works properly.But
when i call something via $.post('check-email.php',{parameter},function{data}) and i try to write return false after that $.post call.It doesn’t works and directly goes to next page.
here is my code:-

$(document).ready(function () { //newly added 
    $('#mysignupform').submit(function (event) {
        return false;
        or event.preDfault(); // only work here
        var emailVal = $('#inputEmail').val(); // assuming this is a input text field
        //alert(emailVal);
        $.post('check-email.php', {
            'email': emailVal
        }, function (data) {
            alert(data);
            if (data == 'false') {
                $("#mysignupform").submit(function (event) {
                    return false;
                    or event.preventDefault(); //both doesnt work here..why??
                    ;
                });
            } else {
                $("#mysingupform").submit(function () {
                    return false;
                }); //retrun false doesnt work here..why??
            }
        });
    });
});

I dont want to allow them to submit but still its happening. Please help me..!
Thanks 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-06-13T06:54:16+00:00Added an answer on June 13, 2026 at 6:54 am

    This should work:

    $(document).ready(function () { //newly added 
        $('#mysignupform').submit(function (event) {
            // your $.post call
            $.post('check-email.php', {email: emailVal}, function (data) {
                // ...
                // having a return false means returning false to the success callback
                // of your .post call. it is not the same as returning false to the 
                // submit() callback
            });
    
            // return false to submit()
            return false;
        });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am puzzled why this return false doesn't cancel the post-back. function validate() {
return false seems to work in the submitHandler but I'm not sure why. function
$(.container).on(contextmenu, .photos-bottom .albums li, function(e) { $('html').bind('click', function (event) { alert(id); }); return false;
I have a click event that will not return false after I have called
What does return true; and return false; exactly responds in user defined functions? function
$(document).keydown(function(e){ if (e.keyCode == 37) { return false; } }); $(.direction).click(function() { var direction
public function __construct($input = null) { if (empty($input)){ return false; } and then there's
I am getting mad regarding why would HttpContext.Current.User.Identity.IsAuthenticated return false in LoggedIn event in
i want call 2 actions but, if return false from first event, second will
I know that JavaScript return false means prevent default event (like preventDefault() method). #1

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.