diff --git a/includes/common.inc b/includes/common.inc
index 91a40cb..1635798 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -3865,7 +3865,8 @@ function drupal_html_id($id) {
       // requested id. $_POST['ajax_html_ids'] contains the ids as they were
       // returned by this function, potentially with the appended counter, so
       // we parse that to reconstruct the $seen_ids array.
-      foreach ($_POST['ajax_html_ids'] as $seen_id) {
+      $ajax_html_ids = explode(' ', $_POST['ajax_html_ids']);
+      foreach ($ajax_html_ids as $seen_id) {
         // We rely on '--' being used solely for separating a base id from the
         // counter, which this function ensures when returning an id.
         $parts = explode('--', $seen_id, 2);
diff --git a/misc/ajax.js b/misc/ajax.js
index 900ca1d..8447834 100644
--- a/misc/ajax.js
+++ b/misc/ajax.js
@@ -292,10 +292,13 @@ Drupal.ajax.prototype.beforeSerialize = function (element, options) {
 
   // Prevent duplicate HTML ids in the returned markup.
   // @see drupal_html_id()
-  options.data['ajax_html_ids[]'] = [];
-  $('[id]').each(function () {
-    options.data['ajax_html_ids[]'].push(this.id);
-  });
+  var ajaxHtmlIds = [];
+  var $ids = $('[id]');
+  for (var i = 0, il = $ids.length; i < il; i++) {
+    ajaxHtmlIds.push($ids[i].id);
+  }
+  // Join IDs to minimize request size.
+  options.data.ajax_html_ids = ajaxHtmlIds.join(' ');
 
   // Allow Drupal to return new JavaScript and CSS files to load without
   // returning the ones already loaded.
