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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T08:49:31+00:00 2026-06-09T08:49:31+00:00

Say I submit the form, it either gives me an error or a success

  • 0

Say I submit the form, it either gives me an error or a success message. I close the modal and if I click to open it again, the message is still there. How do I clear it?

$("#JqAjaxForm").submit(function(e){                
        e.preventDefault();

        dataString = $("#JqAjaxForm").serialize();

        $.ajax({
            type: "POST",
            url: "update.php",
            data: dataString,
            dataType: "json",
            success: function(data) {
            //clearForm("#JqAjaxForm");

                if(data.email_check == "invalid"){ 
                    $("#message_ajax").html("<p class='alert alert-error'>Sorry " + data.name + ", " + data.email + " is NOT a valid e-mail address. Try again.</p>");
                } else {                        
                    $("#message_ajax").html("<p class='alert alert-success'>" + data.newpasswd + " is a valid e-mail address. Thank you, " + data.name + ".</p>"); 
                }     
            }                
        });                 
});


$('#chg_settings').modal({
  backdrop: 'static',
  keyboard: true,
  show: false
});

And I call the modal via

<a data-toggle="modal" href="#chg_settings">Settings</a>

Here’s the message div

<div id="message_ajax"></div>
  • 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-09T08:49:32+00:00Added an answer on June 9, 2026 at 8:49 am

    You can register a hidden event like this

    $('#chg_settings').on('hidden', function () {
      $("#message_ajax").html('');
    })
    

    This event is fired when the modal has finished being hidden from the user (will wait for css transitions to complete).

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

Sidebar

Related Questions

Let's say I'm at http://www.domain.com/page.html . I want to submit this form: <FORM METHOD=post
What does the HTML spec say about using enter key to submit a form?
I submit a form, lets say this form contains <input name=address ..> and <input
I have a form that uses jQuery Validate. You click the Submit button, form
Let's say I have the following scenario: <form action=/something.php method=GET>Click me</div> <script type=text/javascript><!-- $('form').submit(function(e)
Say I submit a form via Ajax and need a response from the server:
I have a modal dialog (done through jquery UI) that submit a form to
I have one ArrayList in Session, lets say for example [305,306,380] . On submit,
I need help to automatically select an option to submit with a form: When
Lets say you had a simple form to create a new article object in

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.