I have below code:
apitest.php
<!DOCTYPE html>
<html>
<head>
<title>WEBPAGE</title>
<link href="main.css" rel="stylesheet" type="text/css" href="" />
<script type="text/javascript">
function test(){
const userAction = async () => {
const response = await fetch('<some_api_url>');
const myJson = await response.json();
document.getElementById("demo").innerHTML = myJson
}
}
</script>
</head>
<body>
<button onclick="test()">Click</button>
<p id="demo"></p>
</body>
</html>
I am trying to demo call GET api whose response is very basic json data:
{"Status":"OK"}
but I am not getting the above response. Can anyone please help me resolve the issue. Thanks