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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T17:49:14+00:00 2026-05-15T17:49:14+00:00

I’ve got the following code: <script type=text/javascript> $(function(){ $(#AddMaps).submit(function(){ var $form = $(‘#AddMaps’); $.ajax({

  • 0

I’ve got the following code:

<script type="text/javascript">

        $(function(){
        $("#AddMaps").submit(function(){

            var $form = $('#AddMaps');

            $.ajax({
                type: 'POST',
                url: $form.attr( 'action' ),
                data: $form.serialize(),
                dataType: "json",
                beforeSend:function(){
                    // Set up Loading Image and disable submit button
                    $('#ajax-panel').html('<div class="loading"><img src="loader.gif" alt="Loading..." /></div>');
                },
                success:function(data){
                    // Successful Request; do something
                    $('#ajax-panel').empty();
                    if (data.response != "Success"){
                        $('#ajax-panel').append('Error Occurred' + data.response);
                    }
                    else {
                        $('#ajax-panel').append('File(s) Uploaded');
                    }
                },
                error:function(){
                    // Failed Request; Freak out
                    $('#ajax-panel').html('<p class="error"><strong>Oops!</strong> Try that again in a few moments.</p>');
                }
            });
        });
        });



        </script>

        <form id="AddMaps" action="test_multiple.php">
            <fieldset>
            <label for="server">Select a Server:</label>
            <select name="server" id="server">
        <option value="1">Server 1</option>
        <option value="2">Server 2</option>
        <option value="3">Server 3</option>
            </select>
            </fieldset>
            <input name="submit" type="submit" id="submit" value="Upload">
            <div id="ajax-panel"></div>
        </form>

The problem I am having, is that the ajax call is entering the success function long before the call to test_multiple.php completes. test_multiple is doing a lot of back end work and if I call it directly the page takes approximately 15 seconds to load. Using this, it is reporting that it completes instantly, even though I can see the work in the backend isn’t done yet.

Why does it enter success right away? How do I stop it from doing so?

Additionally, Firebug is reporting an aborted POST request to test_multiple but a successful GET request to test_multiple.

  • 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-15T17:49:14+00:00Added an answer on May 15, 2026 at 5:49 pm

    That is probably happening because your form is submitting the normal way. You need to return false at the end of your submit handler to prevent the form from redirecting to the specified ‘action’, thus allowing the XHR request to finish.

    Additionally, Firebug is reporting an
    aborted POST request to test_multiple
    but a successful GET request to
    test_multiple.

    The form tag in your markup has no ‘method’ attribute set, so it defaults to GET. This is evidence that your form is being submitted the normal way. The aborted POST is probably because the XHR request did not get a chance to finish before the server received the normal HTTP GET request and starting sending output.

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

Sidebar

Ask A Question

Stats

  • Questions 457k
  • Answers 457k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer On linux, malloc and free are not system calls. malloc/free… May 15, 2026 at 10:53 pm
  • Editorial Team
    Editorial Team added an answer I added another row in your interests table, to demonstrate… May 15, 2026 at 10:52 pm
  • Editorial Team
    Editorial Team added an answer If the order of the lines is not important, you… May 15, 2026 at 10:52 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.