This is my first attempt at javascript trying to call to API and I'm getting the following in the Chrome console:
Uncaught syntax error: Unexpected Token ,
Uncaught Reference Error: AjaxCall is not defined.
I just posted here today, edited the answer to my liking, and got more errors.
Thanks for helping!
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<button onclick="AjaxCall()">Click Here</button>
<p id="Data"></p>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
<script>
var vToken = "MyToken";
var Target_URL = "MyUrl";
function AjaxCall() {
$.ajax({
url: Target_URL,
headers: {
'Accept': 'application/json',
'Authorization',
'Bearer ' + vToken
},
method: 'GET'
success: alert(result)
});
}
</script>
</body>
</html>