Detect when form submission is complete

I have a form which submits to a page on a server that takes a few minutes to load and process the data. During which time, most browsers display the progress bar at the bottom. When the server is done processing the info, it returns a "204 No Content" and the browser stops. I need to detect when this has happened, so I can redirect to another page. I can't change the way the server responds, so this will have to be implemented client-side, presumably using Javascript. Thanks in advance!
LVL 1
J-MikAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

devicCommented:
here ix an example, the iframe can be hidden:
=============================
<script>
function notification()
{
      var theHREF;
      try
      {
            theHREF=frames.hdIframe.location.href;
      }
      catch(e)
      {
            theHREF="access denied"
      }
      if(theHREF!="about:blank")
      {
            alert("form submited!")
      }
}
</script>

<form action=http://www.google.com/search target="hdIframe">
      <input name=q value=hurra>
      <input type=submit>
</form>
<iframe name=hdIframe src=about:blank onload="notification()"></iframe>

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
J-MikAuthor Commented:
Devic,

This doesn't seem to work. The onLoad event of the IFRAME triggers as soon as the page with the form loads (before the submitting happens) and then does not trigger again even after the form is submitted through it.
0
devicCommented:
that happens, because you changed my code or you are using only a part of this.
show me what you do, and I tell you what is wrong
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

GwynforWebCommented:
try this

<script>
function notification()
{alert("form submission finished!")
}
flag=false
</script>

<form action="http://www.google.com/search" target="hdIframe">
 <input name="q" value="hurra">
 <input type="submit">
</form>

<IFRAME name="hdIframe" src="about:blank" onload="(flag)?notification():flag=!flag">
</IFRAME>
0
J-MikAuthor Commented:
Well, I don't think I changed anything, but here's the code anyways:

 <SCRIPT TYPE="text/javascript">
 <!--
                                       
   function Check() {
     var HREF;
     try {
       HREF = frames.HFrame.location.href;
     } catch(Err) {
       HREF = "Access Denied";
     }
     if (HREF != 'about:blank') { alert(HREF); }
   }
                                       
 //-->
</SCRIPT>

<FORM ACTION="default.asp" METHOD="Post" TARGET="HFrame">
<TABLE CELLPADDING=0 CELLSPACING=10 BORDER=0 ALIGN="Center">
   <TR VALIGN="Middle">
     <TD><INPUT TYPE="Text" SIZE=20 MAXLENGTH=20 ID="Username" NAME="Username"></TD>
     <TD ROWSPAN=2 ALIGN="Center"><INPUT TYPE="Image" SRC="/Button-Submit.gif"></TD>
  </TR>
   <TR>
     <TD><INPUT TYPE="Password" SIZE=20 MAXLENGTH=20 ID="UserPass" NAME="UserPass"></TD>
  </TR>
</TABLE>                                            

</FORM>
<IFRAME NAME="HFrame" ID="HFrame" SRC="about:blank" onLoad="Check()"></IFRAME>


I tested this in Internet Explorer, Firefox and Opera, and in all three cases, the function is not run when the form is done submitting. Don't forget that the server does not return a blank page, it return a 204, which means the IFRAME's location never changes. Thanks again.
0
devicCommented:
can you give the full url of the action?
0
J-MikAuthor Commented:
Devic,
"default.asp" is the full URL. It's an IIS page hosted on the same machine that this page runs on, in the local Intranet.

GwynforWeb,
Thanks for the try, but your code doesn't change anything. The function still isn't called a second time (again, probably because the page is not loaded)
0
devicCommented:
the same machine....
why you don't use  Response.Redirect ?
0
J-MikAuthor Commented:
Devic,

As I mentionned, I cannot change the server's script at all, so this is not an option. :)
0
devicCommented:
J-Mik,

then I would say you can not do nothing...

or probably you must ask the people, who can change this file ;)

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.