asked on
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("button").click(function(){
$.ajax({
url: "http://127.0.0.1:8000/press/bank/1/1",
success: function(data)
{
console.log(data);
if (data == "ok") {
$("#div1").html(data);
} else {
alert("not ok :( - " + data);
}
},
error: function(jqXHR, textStatus, errorThrown)
{
console.log("Oops: " + textStatus + errorThrown);
}
});
return false;
});
});
</script>
</head>
<body>
<div id="div1"></div>
<button>button</button>
</body>
</html>
Access to XMLHttpRequest at 'http://127.0.0.1:8000/press/bank/1/1' from origin 'http://localhost' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
untitled.html:36 Oops: error