Title: rangoy's Replies | WordPress.org

---

# rangoy

  [  ](https://wordpress.org/support/users/rangoy/)

 *   [Profile](https://wordpress.org/support/users/rangoy/)
 *   [Topics Started](https://wordpress.org/support/users/rangoy/topics/)
 *   [Replies Created](https://wordpress.org/support/users/rangoy/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/rangoy/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/rangoy/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/rangoy/engagements/)
 *   [Favorites](https://wordpress.org/support/users/rangoy/favorites/)

 Search replies:

## Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)

 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[The Events Calendar] Previous Events button does not work (REST: error 400 “missing parameters”)](https://wordpress.org/support/topic/previous-events-button-does-not-work-rest-error-400-missing-parameters/)
 *  Thread Starter [rangoy](https://wordpress.org/support/users/rangoy/)
 * (@rangoy)
 * [3 years, 2 months ago](https://wordpress.org/support/topic/previous-events-button-does-not-work-rest-error-400-missing-parameters/#post-16496739)
 * Thank you very much for the update!
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[The Events Calendar] Previous Events button does not work (REST: error 400 “missing parameters”)](https://wordpress.org/support/topic/previous-events-button-does-not-work-rest-error-400-missing-parameters/)
 *  Thread Starter [rangoy](https://wordpress.org/support/users/rangoy/)
 * (@rangoy)
 * [3 years, 2 months ago](https://wordpress.org/support/topic/previous-events-button-does-not-work-rest-error-400-missing-parameters/#post-16483447)
 * One more update to the update. Even though my hack worked, reading [jquery documentation](http://api.jquery.com/jquery.ajax/)
   I suspect I found the root cause of the issue.
   The _accepts_: in obj.getAjaxSettings
   is not actually necessary, because it depends on the dataType. So, just deleting/
   commenting out the line “accepts:'html'” (manager.js line 499) actually fixes
   the issue, because the Accept header will be correct by datatype default.Alternatively,
   if the accepts for some reason should be explicit, it would need to be specified
   as follows, which would give the same result as deleting the line:
 *     ```wp-block-code
       accepts: {
          'html': 'text/html'
           },
       dataType: 'html',
       ```
   
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[The Events Calendar] Previous Events button does not work (REST: error 400 “missing parameters”)](https://wordpress.org/support/topic/previous-events-button-does-not-work-rest-error-400-missing-parameters/)
 *  Thread Starter [rangoy](https://wordpress.org/support/users/rangoy/)
 * (@rangoy)
 * [3 years, 2 months ago](https://wordpress.org/support/topic/previous-events-button-does-not-work-rest-error-400-missing-parameters/#post-16483300)
 * An update:
   After hours of investigation far outside my competence, I was able
   to find a workaround for this, and perhaps it could help others. Using _Postman_,
   i tried to find out excactly what was treated different by the two servers, and
   finally found that the difference was in the server side handling of the Request
   Header “_accept: undefined”_.Checking the plugin source code, I found that the
   ajax request is set up in obj.getAjaxSettings with accepts: ‘html’, but that 
   this does not affect the headers actually sent by the XHR request. In order to
   set the header explicitly, I added a line to obj.ajaxBeforeSend telling it to
   set the request header like **jqXHR.setRequestHeader(“Accept”, “\*/\*”) ** or**
   jqXHR.setRequestHeader(“Accept”, “text/html”) ** – the main thing seems to be
   that the slash needs to be present. So, in context,  I amended /src/resources/
   js/views/manager.js (line 531) like this:
 *     ```wp-block-code
       obj.ajaxBeforeSend = function( jqXHR, settings ) {
                      var $container = this;
                      var $loader = $container.find( obj.selectors.loader );
   
                      jqXHR.setRequestHeader("Accept", "*/*");
                      $container.trigger( 'beforeAjaxBeforeSend.tribeEvents', [ jqXHR, settings ] );
   
                      if ( $loader.length ) {
                              $loader.removeClass( obj.selectors.hiddenElement.className() );
                              var $loaderText = $loader.find( obj.selectors.loaderText );
                              $loaderText.text( $loaderText.text() );
                      }
                      $container.attr( 'aria-busy', 'true' );
   
                      $container.trigger( 'afterAjaxBeforeSend.tribeEvents', [ jqXHR, settings ] );
              };
       ```
   
 * Voilà, it works! So, I guess there must be some kind of bug here, either in the
   plugin or in jquery itself, that is only triggered by some server setups being
   stricter about the format of the accept header. I also noticed that this code
   in manager.js (line 499 emphasized):
 *     ```wp-block-code
       obj.getAjaxSettings = function( $container ) {
        var ajaxSettings = {
         url: $container.data( 'view-rest-url' ),
         accepts: 'html',
         dataType: 'html',
         method: $container.data( 'view-rest-method' ) || 'POST',
         'async': true, // async is keyword
         beforeSend: obj.ajaxBeforeSend,
         complete: obj.ajaxComplete,
         success: obj.ajaxSuccess,
         error: obj.ajaxError,
         context: $container,
       };
       ```
   
 * … counterintuitively does nothing to set the actual header. For reference, I 
   am running the newest Chrome 110.0.5481.100 on Linux, but tested also in modern
   Edge and Konqueror, with the bug consistent in both and also being reported by
   users on other platforms. The server reports Server API LiteSpeed V8.0.1 Cloudlinux
   1.3.
   So with this line added, it works for me, for now. But any feedfack is welcome
   as to whether my fix is the correct one. Thanks in advance!

Viewing 3 replies - 1 through 3 (of 3 total)