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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T20:41:55+00:00 2026-05-14T20:41:55+00:00

Here’s my test case. If the form is posted, a 500 error response is

  • 0

Here’s my test case. If the form is posted, a 500 error response is sent. If not, the form is sent.

If the file input tag is commented out, the error handler is called. If the file input tag is present, the error handler isn’t called. I think this might have something to do with the fact that jQuery needs to use an iframe to handle the upload and iframes don’t seem to respond to the error handler.

Edit:
If I add iframe: true to the options passed to ajaxSubmit to force the use of an iframe, the non-file-upload case stops working also, so it definitely has to do with the iframe.

Edit2: I’m using the jQuery Form Plugin.

<?php
    if($_SERVER['REQUEST_METHOD'] == 'POST') {
        header('HTTP/1.1 500 Internal Server Error');
        die;
    } else {?>
    <html><head>
        <script type='text/javascript'
          src='http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js?ver=2.9.2'></script>
        <script type='text/javascript'
          src='http://github.com/malsup/form/raw/master/jquery.form.js?v2.43'></script>
        <script type="text/javascript">
            jQuery(document).ready(function() {
                jQuery('a').click(function() {jQuery('form').ajaxSubmit({error: function(){alert('error handler called');}})});
            });
        </script>
    </head><body>
        <form method="POST">
            <input type="text" name="mytext" />
            <input type="file" name="myfile" /><!-- comment this element out -->
            <input type="hidden" name="blah" value="blah" />
            <a>submit</a>
        </form>
    </body></html>

<?php }

Is there any way to get the error handler to be called in both situations?

  • 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-14T20:41:56+00:00Added an answer on May 14, 2026 at 8:41 pm

    As far as I can tell from looking at the .ajaxSubmit code, no attempt is made to detect or handle errors in the case that you’ve submitted to an <iframe>. I suspect that’s because there’s just no way for it to learn about the error code that came back from the server in the HTTP response targeted at the <iframe>. It does call the “success” and “complete” plugins, and it tries to cobble together a fake xhr object using whatever it finds in the DOM in the <iframe>.

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

Sidebar

Related Questions

Here is the code: create table `team`.`User`( `UserID` bigint NOT NULL AUTO_INCREMENT , `Username`
Here is my SQL script CREATE TABLE tracks( track_id int NOT NULL AUTO_INCREMENT, account_id
Here's what I'm doing. I want to upload multipart file via Ajax to my
Here is what I have, but it is not working: if(window.width() < 1000) document.getElementsByTagName('body')[0].id=be
Here's a problem I ran into recently. I have attributes strings of the form
Here is my code, which takes two version identifiers in the form 1, 5,
Here is an object that I'd like to use with ng-repeat, but it's not
Here is a XML: <mesh> <triangles material=face count=990> <input semantic=VERTEX source=#boyShape-skin-vertices offset=0/> <input semantic=NORMAL
Here I am trying to retrieve the response from the server and display it,
Here's my test function (c#, visual studio 2010): [TestMethod()] public void TestGetRelevantWeeks() { List<sbyte>

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.