this the html file
<html>
<head>
<title>"api call"</title>
</head>
<body>
<div id="demo">
<script>
function list() {
var xhttp = new XMLHttpRequest();
xhttp.open("GET","192.168.0.101:8000/students/",true);
xhttp.setRequestHeader("Content-type", "application/json");
xhttp.setRequestHeader("Authorization", "Token ad4140b1caa4f98160bdc979a71a7215ae5972fe");
xhttp.send();
var1 response = JSON.parse(xhttp.responseText);
document.write(var1);
}
</script>
<button type="button" onclick="list()">click to get the list</button>
</div>
</body>
</html>
when i run this in my browser request is not sent(i cannot see anything in my traceball in backend) the url works fine if used in the browser and postman this is the screenshot of postman request and response
the backend is in django
this is the error i get in console
var1 response = JSON.parse(xhttp.responseText);
error:Uncaught SyntaxError: Unexpected identifier