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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T05:29:28+00:00 2026-05-13T05:29:28+00:00

I have a form and I’m trying to perform Ajax posts. With the default

  • 0

I have a form and I’m trying to perform Ajax posts.

With the default submit button the dialog window closes, with the jQuery button, nothing happens.
I want the dialog window to stay open so I can keep doing Ajax requests uninterrupted and only close when I press Esc or click the big “X”.
Thanks

<div id="formBox" style="display: hidden;">
   <form>
      <fieldset>
      <legend>File System Space Calculator</legend>
      <p>
         <label for="curr_alloc">Current Space Allocation:</label> 
         <br />
         <input type="text" size="5" name="curr_alloc" id="curr_alloc" />
         &nbsp;KB <input type="radio" name="curr_unit" value="KB" />
         &nbsp;MB <input type="radio" name="curr_unit" value="MB" />
         &nbsp;GB <input type="radio" name="curr_unit" value="GB" checked/>
         &nbsp;TB <input type="radio" name="curr_unit" value="TB" />
      </p>
      <p>
      <label for="curr_percent">Current Usage Percentage:</label> 
      <br />
         <input type="text" size="5" name="curr_percent" id="curr_percent" />
      </p>
      <p>
      <label for="desired_percent">Desired Usage Percentage:</label> 
      <br />
         <input type="text" size="5" name="desired_percent" id="desired_percent" />
      </p>
      <br />
      <p>
         <input type="submit" value="calculate"/></p>
      </fieldset>
   </form>
</div>

<div id="calcBox" style="display: none;"> </div>

<script>
$(document).ready(function() {
    $("#formBox").dialog({
      bgiframe: true,
  autoOpen: false, 
  height: 500,
  width: 500, 
  modal: false,
  closeOnEscape: true,
  title: "Calculator",
  closeText: 'Close',
  buttons: 
   {
   "Calculate": function()
/* form post */

$("#calcQuery").submit(function(){
        $.post("calc.php", $("#calcQuery").serialize(),
        function(data){
    if (data.length > 0)
    {
          $("#calcBox").html(data);
          $("#calcBox").show();
    }
    else
    {
          $("#calcBox").html("<h1>nuttin' here yet</h1>");
    }
        }, "html");

        return false;

    });

/* form post */
    }
   } 
    });

$('#calcButton').click(function(){
 $('#formBox').dialog('open');
 return false;
 });



  });

</script>
  • 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-05-13T05:29:29+00:00Added an answer on May 13, 2026 at 5:29 am

    This works (except for form reset which is addressed in another post)

    // form popup 
    $(document).ready(function() 
    {
    
        $("#formBox").dialog({
          bgiframe: true,
            autoOpen: false, 
            height: 600,
            width: 400, 
            modal: false,
            closeOnEscape: true,
            title: "Calculator",
            buttons:    {
                "Calculate": function() {
    
    // form post
                $.ajax({
                type: "POST",
                url: "calc.php",
                data: $("#calcQuery").serialize(),
                dataType: "html",
                success: function(response)
                    {
                    $("#calcBox").html(response);
                    $("#calcBox").show();   
                    },
                error: function
                    (xhr, ajaxOptions, thrownError)
                        {
                        alert(xhr.status); 
                        alert(thrownError);
                        }
    
    
    
        }).responseText;
    
    // form post 
    
                    }
                } 
        });
    
    $('#calcButton').click(function(){
        $('#formBox').dialog('open');
    
        });
    
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have form with input 's. When it's opened (via jQuery UI: Dialog)... cursor
I have form where before i was using simple post with <button name=submit id=register
I have form with 1 button. when you click on the button 3 others
I have form with few buttons and I want to know what button is
I have form in my page, I am using ajax.beginform(). Inside this form I
i have form with user data to input and javascript ajax to send information
i have form and i am using jquery validate jquery.validate.pack.js its work fine when
I have form with web browser component, there is a button which triggers page
I have form who validate user input, I use PHP, Javascript and AJAX. I
Let's say I have form looks like First: Use jQuery to display data like

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.