Override views/ajax path

Error message

  • Deprecated function: Methods with the same name as their class will not be constructors in a future version of PHP; GeSHi has a deprecated constructor in require_once() (line 818 of /home/xenyomed/public_html/sites/all/modules/libraries/libraries.module).
  • Deprecated function: Function create_function() is deprecated in GeSHi->_optimize_regexp_list_tokens_to_string() (line 4736 of /home/xenyomed/public_html/sites/all/libraries/geshi/geshi.php).
  • Deprecated function: Methods with the same name as their class will not be constructors in a future version of PHP; ctools_context has a deprecated constructor in require_once() (line 127 of /home/xenyomed/public_html/sites/all/modules/ctools/ctools.module).
  • Deprecated function: Methods with the same name as their class will not be constructors in a future version of PHP; ctools_context_required has a deprecated constructor in require_once() (line 127 of /home/xenyomed/public_html/sites/all/modules/ctools/ctools.module).
  • Deprecated function: Methods with the same name as their class will not be constructors in a future version of PHP; ctools_context_optional has a deprecated constructor in require_once() (line 127 of /home/xenyomed/public_html/sites/all/modules/ctools/ctools.module).
  • Deprecated function: The each() function is deprecated. This message will be suppressed on further calls in _menu_load_objects() (line 579 of /home/xenyomed/public_html/includes/menu.inc).

WE HAVE MOVED!

Please visit our new Drupal Website at https://www.xenyo.com.

/**
 * js file
 */
 
(function ($) {
  /* this code stole from ajax_view.js , just use this to override the ajax path */
  if (Drupal.views != undefined) {
    Drupal.views.ajaxView.prototype.attachPagerLinkAjax = function(id, link) {
      var $link = $(link);
      var viewData = {};
      var href = $link.attr('href');
      $.extend(
        viewData,
        this.settings,
        Drupal.Views.parseQueryString(href),
        Drupal.Views.parseViewArgs(href, this.settings.view_base_path)
      );
      $.extend(viewData, Drupal.Views.parseViewArgs(href, this.settings.view_base_path));
 
      this.element_settings.submit = viewData;
      if (this.element_settings.submit['view_name'] == 'yourviewname') {  //if viewname matched
        this.element_settings.url = '/result_ajax';  //change views/ajax to your ajax path
        var query = $('#modulename-ajax-compare-result-form').serialize();  //add any data you want to pass before ajax call
        this.element_settings.submit['data'] = query;
      }
      this.pagerAjax = new Drupal.ajax(false, $link, this.element_settings);
    };
  }
})
Help Share this Article