Index: includes/form.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/form.inc,v
retrieving revision 1.320
diff -u -r1.320 form.inc
--- includes/form.inc	3 Feb 2009 18:55:29 -0000	1.320
+++ includes/form.inc	18 Feb 2009 06:16:44 -0000
@@ -445,6 +445,10 @@
       // however, we'll skip this and let the calling function examine
       // the resulting $form_state bundle itself.
       if (!$form['#programmed'] && empty($form_state['rebuild']) && empty($form_state['storage'])) {
+        // Give modules a chance to do something other than redirect on form success.
+        // For example, an Ajax module could output state as JSON.
+        module_invoke_all('form_process_success', $form, $form_state);
+        // Unless redirect is cancelled, form handling ends here.
         drupal_redirect_form($form, $form_state['redirect']);
       }
     }
