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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T15:10:09+00:00 2026-06-11T15:10:09+00:00

I am facing a problem that when I submit the page (form) the submission

  • 0

I am facing a problem that when I submit the page (form) the submission to php mail is success but the page again reloads. Tried return true and false also preventDefault() but still the page reloads.

$('#frmRequest').submit(function(e){
    //$('#SUBMIT').click(function(){
    var isValidForm = true;
    $('#RequestDetailsArea').find('input:visible, textarea:visible, select:visible').each(function(){
        if( $(this).val().length == 0|| $(this).val()=='Select' ) {
            $(this).addClass('validation');
            isValidForm = false;      
        }
        else {
            $(this).removeClass('validation'); 
            $('#ErrorRequest').addClass('hidden');           
        }
    });/* end check validation in RequestDetailsArea*/
    if (!isValidForm) {
        $('#ErrorRequest').removeClass('hidden');   
    }
    validreturn=validateForm();
    if(isValidForm && validreturn)
    {
        $('#RequestDetailsArea').find('div:hidden').each(function(){
            //alert($(this).attr('id'));
            $(this).remove();
        });

        msg="ok";
        $.ajax({
            url:"allfields.php",
            type:"POST",
            //      dataType:"json",
            data: $("#frmRequest").serialize(),
            success: function(msg){
                //alert("Form Submitted: "+ msg);
                return msg;

            },
            error: function() {
                alert('Error occured');
            }
        });
        e.preventDefault();

        //return false;
    }
});/* end of submit Function*/
  • 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-11T15:10:11+00:00Added an answer on June 11, 2026 at 3:10 pm

    In your code you have put e.preventDefault(); inside

    if(isValidForm && validreturn)
    {
        //...
        e.preventDefault();
    }
    

    So I think if your condition doesn’t match then the form will be submitted because the calling of method e.preventDefault(); won’t be executed. If this is the case then you can keep it out of your if condition, i.e,

    $('#frmRequest').submit(function(e){
        e.preventDefault();
        // rest of your code here
    });
    

    Update: You are using return msg in your success, that will do nothing, you can do it in this way

    success: function(msg){
        returnValue(msg); // call the function      
    }
    

    and declare the returnValue somewhere in the script like

    function returnValue(data)
    {
        // do something with data
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im currently facing the problem that when i try to set focus on some
I'm facing a problem that I can summarize as it follows: I have a
I'm facing a problem that drives me crazy, I created a java application using
I'm facing a problem that seems to have no straighforward solution. I'm using java.util.Map
I am facing the problem that I cannot properly map my foreign key table
Here i am facing a problem that , i configured the hibernate sessionfactory in
I'm working with Eclipse and ClearCase and we're facing the problem that there's no
I am facing problem with iframe that too in chrome. How to make IFRAME
I am facing a design problem that I cannot figure out at all. I
So here is the problem that I am facing: I have an application that

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.