Expand my Community achievements bar.

SOLVED

jQuery is prepending "/ajax" to URLs

Avatar

Level 7

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.

1 Accepted Solution

Avatar

Correct answer by
Level 7

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

View solution in original post

1 Reply

Avatar

Correct answer by
Level 7

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