onComplete not being triggered

a place to get help

Moderator: 1.1 Moderators

onComplete not being triggered

Postby Fire-EnigmaX on Wed Nov 19, 2008 9:45 pm

Hi Guys,

I am having a bit of a problem getting my OnComplete function to triger when submitting a form etc.

I am using classic ASP (i know, but I have no choice for this one - client request). Basically I have a form and on submitting it, it calls another .asp page. which will do some processing and when complete send back a message to inform the user if their submission was fine or not. While the form is submitting it displays a "loading" image.

The problem is that even when the response comes back but the loading image stays, so i think that the AJAX call isnt recieving a suitable "response" from the asp page - but I may be mistaken!

The code I have for the form is below:

  1.  
  2.     <div id="member">
  3.       <h2>REGISTER FOR INFORMATION<h2>
  4.         <div id="memberForm_AJAX_Wrapper">
  5.             <div id="memberForm_AJAX_Response"></div>                        
  6.         </div>
  7.  
  8. <form action="registerUser.asp" method="POST" name="register_information" id="register_information">
  9.         <label>Name:</label>
  10.         <input type="text" name="name" class="txtBox" />
  11.         <label>E-mail Address:</label>
  12.         <input type="text" name="emailAdd" class="txtBox" />
  13.         <label>Mobile No:</label>
  14.         <input type="text" name="mobileNo" class="txtBox2" />
  15.    
  16.         <input type="submit" name="go" value="Go" class="go" />
  17.         <br class="spacer" />
  18.       </form>
  19. </div>
  20.  

  1.  
  2. <script type="text/javascript" language="javascript" >
  3.         window.addEvent('domready', function() {
  4.              $('register_information').addEvent('submit', function(e) {
  5.                 /**
  6.                  * Prevent the submit event
  7.                  */
  8.                 new Event(e).stop();
  9.              
  10.                 /**
  11.                  * This empties the log and shows the spinning indicator
  12.                  */
  13.                 var log = $('memberForm_AJAX_Response').empty().addClass('memberForm_AJAX_Load');
  14.              
  15.                 /**
  16.                  * send takes care of encoding and returns the Ajax instance.
  17.                  * onComplete removes the spinner from the log.
  18.                  */
  19.                 this.send({
  20.                     update: log,
  21.                     onComplete: function() {
  22.                         log.removeClass('memberForm_AJAX_Load');
  23.                     }
  24.                                        
  25.                 });
  26.             });
  27.         });    
  28.        
  29. </script>
  30.  


The asp page at the moment only contains a simple response.write -- until i can get this working.

  1.  
  2. Response.Write("Mail Sent!")
  3.  



I'm not that familiar with AJAX and Mootools, so far I have only been able to tweek examples given etc, so any help would be brilliant!
Fire-EnigmaX
 
Posts: 3
Joined: Wed Nov 19, 2008 9:26 pm

Return to Help

Who is online

Users browsing this forum: No registered users and 1 guest