Ajax call from macro not rendering + weird warnings in console

hi
in a user macro , i’m trying to make an ajax call (a simple get for now) to a third party API REST with authentication
my code is kind of:

.
.
.
#set($D=‘$’)
<script type=“text/javascript”>
function myfunction()
{
var myURL=“my url starting with 'http://user:password@XXXXXXXXXXXXXXX”;
var myjson;
AJS.${D}.ajax({
type: ‘get’,
dataType: “json”,
async: false,
url: myURL,
success: function(data) {
myjson = data.entities;
}

});
return myjson ;
}

</script>

in return i dont get anything and in the web console i got theses warnings:


DEPRECATED JS - Cookie has been deprecated since 5.8.0 and will be removed in a future release. Use cookie instead.

DEPRECATED JS - Dialog has been deprecated since 6.0.6 and will be removed in a future release. Use require(‘confluence-create-content/space-blueprint’) /contextbatch/js/_super/batch.js?locale=en-GB:639:134


any ideas

Thank you

You can ignore the messages. Check network tab in chrome console to see if the call was made. If yes, then see if it completed or produced empty response.

thank you for the reply
before developing this get i tested it with a Curl and i had what i wanted as json
is my ajax function correct?

Try running you Ajax function in chrome console on the page you want it to run. You could also use postman(very handy software)