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

  • Home
  • SEARCH
  • 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 8165235
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T19:29:22+00:00 2026-06-06T19:29:22+00:00

I have a form in a jQuery popup on a webpage. The jQuery popup

  • 0

I have a form in a jQuery popup on a webpage. The jQuery popup is a div named .vote-form and the form inside it has the name “#form”.

When the form is submitted, the content inside the jQuery popup changes to a success message. I need to make it so that when the jQuery popup is closed, the success message is removed and the form is refreshed back to the original form, so that when the jQuery popup is opened again, the form is showing again and NOT the success message.

My feeble attempt to get this result involved refreshing the ENTIRE page when the jQuery popup is closed. This PARTLY has the desired result, but when the page is refreshed, most browsers get a popup asking if the user wants to resubmit the form content. I need to avoid this.

This was my code handling the closing of the .vote-form:

$('.vote-form-close').click(function(event) {
    event.stopPropagation();
    $(".vote-form").fadeOut("normal");
    $("#the-lights").fadeTo("slow",0);
    $("#the-lights").css({'display' : 'none'});
    window.location.reload();
});

I suspect that its possible to refresh ONLY the div, and not the entire page, but I do not know how to accomplish it.

Can someone assist me?

EDIT: Based on one of the answers below, I modified my code. I also wanted to show the code used to open the form up too:

$('.vote').click(function() {
    $(this).parent().find(".vote-form").fadeIn("normal");
    $("#the-lights").css({'display' : 'block'});
    $("#the-lights").fadeTo("slow",0.7);
});
$('.vote-form-close').click(function(event) {
    event.stopPropagation();
    $(".vote-form").fadeOut("normal");
    $("#the-lights").fadeTo("slow",0);
    $("#the-lights").css({'display' : 'none'});
    $(".vote-form").load(window.location.href  + " .vote-form-container");
});

Here is the problem – I have 3 forms on the page. When “vote-form-container” is loaded, its loading ALL THREE forms into the .vote-form box – how do I modify the code to only load the .vote-form-container that is part of the specific .vote-form – I suspect I have to use $(this) but I tried modifying the code to this and it didnt work:

$(".vote-form")(this).load(window.location.href  + " .vote-form-container");

I am thinking I did it wrong.

EDIT 2: Now the “Close” button dosen’t work after the form is reloaded the first time:

$('.vote').click(function() {
    $(this).parent().find(".vote-form").fadeIn("normal");
    $("#the-lights").css({'display' : 'block'});
    $("#the-lights").fadeTo("slow",0.7);
});
$('.vote-form-close').click(function(event) {
    event.stopPropagation();
    $(".vote-form").fadeOut("normal");
    $("#the-lights").fadeTo("slow",0);
    $("#the-lights").css({'display' : 'none'});
    var current_form = $(this).closest('.vote-form'),
    index = $('.vote-form').index(current_form)
    current_form.load(window.location.href  + " .vote-form-container:eq(" + index + ")");
});
  • 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-06T19:29:23+00:00Added an answer on June 6, 2026 at 7:29 pm

    Don’t reload the page but redirect your user:

    window.location.href = window.location.href.toString()
    

    Or load the new form with ajax:

    $(".vote-form").load(window.location.href  + " .vote-form");
    

    For more information on the ajax approach see api.jquery.com/load/#loading-page-fragments


    Update:

    Using jQuery the index function you are able to replace only the current form.

     // I asume your button is in the form
     var current_form = $(this).closest('.vote-form'),
         index = $('.vote-form').index(current_form)
    
     current_form.load(window.location.href  + " .vote-form:eq(" + index + ")");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a popup select box in a form in my jQuery Mobile application.
I have a form on a webpage that I submit using the jquery form
I have a JQuery modal popup form on a classic ASP page. It's set
I have a JQuery UI dialog popup that displays a form. By selecting certain
I have a modal popup with a form in it. When submitted via ajax
I have a jQuery popup box made with a div . When the user
I have a div with a form inside it. The form is small, consists
What I have is an that opens up a Jquery popup with a form
I have a form that has a popup page with another form. In that
I have a form what jQuery sents for me using Ajax to php. For

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.