commit 5d7500fadef175132ceb433b93648cc3a7c5871e
Author: fago <nuppla@zites.net>
Date:   Fri Mar 5 15:06:24 2010 +0100

    js fix

diff --git misc/ajax.js misc/ajax.js
index c31b243..be1d3a1 100644
--- misc/ajax.js
+++ misc/ajax.js
@@ -111,10 +111,14 @@ Drupal.ajax = function (base, element, element_settings) {
   this.wrapper = '#' + element_settings.wrapper;
 
   // If there isn't a form, jQuery.ajax() will be used instead, allowing us to
-  // bind AJAX to links as well.
+  // bind AJAX to links as well. But if the element is inside a form, the form
+  // will be submitted.
   if (this.element.form) {
     this.form = $(this.element.form);
   }
+  else if ($(this.element).closest('form').length) {
+    this.form = $(this.element).closest('form');
+  }
 
   // Set the options for the ajaxSubmit function.
   // The 'this' variable will not persist inside of the options object.
