Please see below simple code block that makes a basic jQuery get call
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Get test</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js">
</script>
<script>
// register callback on windows.load
$( window ).on( "load", loaderfunc );
// loaderfunc definition
function loaderfunc (jQuery)
{
alert("calling get now");
$.get('https:/myrestfulservice-get-endpoint.mydomain.net',
function (data){
alert("in callback from get");
}
.fail(function (jqXHR,settings,ex) {
alert('failed, '+ ex);
})
.done(function(data) {
alert("json retrieve success");
})
)
}
</script>
</head>
<body>
<h1> TEST PAGE FOR GET REQUEST </h1>
</body>
</html>
In this I see alert "calling get" on page load. However thereafter I don't see any alert either for success or for failure I did verify that my service at provided url returns a valid http response - that happens to be a json string ( "https:/myrestfulservice-get-endpoint.mydomain.net" this service name is fudged )
I am open to using getJSON - however that too fails silently What am I missing