In one of the sheets in my xwiki application, I want to fire REST calls to an external application(not built on xwiki) by using javascript/jquery code. The url of external app which I am providing is like this - “https://abc.in/v2/entities/patient”.
This is the javascript/jquery code which I am using to fire REST call -
$.ajax({
url: “https://abc.in/v2/entities/patient”,
dataType: ‘JSON’,
type: ‘GET’,
headers: AUTH_HEADERS,
success: function (data) {
console.log(data);
}
});
But when I execute the above javascript/jquery code, I get an error in console “Uncaught syntaxError : Unexpected identifier” and then I can see in ‘Sources’ tab that xwiki has automatically prepended this external app url with some <span>
and <a>
tags
$.ajax({
url: "<span class="wikiexternallink"><a class="wikimodel-freestanding" href="https://abc.in/v2/entities/patient"><span class="wikigeneratedlinkcontent">https://abc.in/v2/entities/patient</span></a></span>",
dataType: ‘JSON’,
type: ‘GET’,
headers: AUTH_HEADERS,
success: function (data) {
console.log(data);
}
});
This is causing my REST call code to fail.
How can I prevent xwiki to modify any external application url ?