Switch Drupal ajax to type 'get'

Public

Make drupal ajax work via GET

Get raw version
javascript
  1. // Keep standard behavior.
  2. Drupal.ajax.prototype.originalBeforeSerialize = Drupal.ajax.prototype.beforeSerialize;
  3. Drupal.ajax.prototype.beforeSerialize = function (element, options) {
  4. // Any conditions you need.
  5. if (options.url) {
  6. options.type = 'GET';
  7. return;
  8. }
  9. return this.originalBeforeSerialize(element, options);
  10. };