jQuery is prepending "/ajax" to URLs | Community
Skip to main content
LinearGradient
Level 6
October 16, 2015
Solved

jQuery is prepending "/ajax" to URLs

  • October 16, 2015
  • 1 reply
  • 617 views

Hi,

When making AJAX POST requests, CQ is prepending "/ajax" to the URLs.

I had a look at the code that is executed, and looks like somewhere along the way this CQ callback is executed which prepends the "/ajax" to URLs:

beforeSend: function (jqXHR, s) { // s: settings provided by the ajax call or default values if (typeof G_IS_HOOKED == "undefined" || !G_IS_HOOKED(s.url)) { if (s.externalize) { // add context to calls s.url = http.externalize(s.url); } if (s.encodePath) { s.url = http.encodePathOfURI(s.url); } } if (s.hook) { // portlet XHR hook var hook = http.getXhrHook(s.url, s.type, s.data); if (hook) { s.url = hook.url; if (hook.params) { if (s.type.toUpperCase() == 'GET') { s.url += '?' + $.param(hook.params); } else { s.data = $.param(hook.params); } } } } }

Is there a way to prevent CQ from executing this callback when we submit an AJAX request from our JavaScript code?

Thanks in advance.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by LinearGradient

The cq.foundation-main clientlib should be included in the pages in order to fix the issue.

1 reply

LinearGradient
LinearGradientAuthorAccepted solution
Level 6
October 16, 2015

The cq.foundation-main clientlib should be included in the pages in order to fix the issue.