diff --git a/docroot/misc/ajax.js b/docroot/misc/ajax.js
index 01b894d..a2daed5 100644
--- a/docroot/misc/ajax.js
+++ b/docroot/misc/ajax.js
@@ -129,7 +129,12 @@ Drupal.ajax = function (base, element, element_settings) {
   //      E.g.: ?q=path/nojs&destination=foobar
   // 5. /nojs# - Followed by a fragment.
   //      E.g.: path/nojs#myfragment
-  this.url = element_settings.url.replace(/\/nojs(\/|$|\?|&|#)/g, '/ajax$1');
+  if($.isArray(element_settings.url)) {
+      element_settings.url = element_settings.url[0];
+  }
+  if ($.isFunction(element_settings.url.replace)) {
+    this.url = element_settings.url.replace(/\/nojs(\/|$|\?|&|#)/g, '/ajax$1');
+  }
   this.wrapper = '#' + element_settings.wrapper;
 
   // If there isn't a form, jQuery.ajax() will be used instead, allowing us to

