I'm using the following script -
<!DOCTYPE html>
<html>
<head>
<script src="jquery-1.9.1.min.js"></script>
<script>
function postForm() {
$.ajax({
type: 'POST',
url: 'http://10.0.0.8:9000/demo',
data: {"name" : "test"},
contentType: "application/json; charset=utf-8",
dataType: 'json',
})
}
</script>
</head>
<body>
<form id="ajaxForm" onsubmit="postForm(); return false; " method="post">
<input id="test" type="text" name="name" value="Hello JSON" />
<input type="submit" value="Submit JSON" />
</form>
</body>
</html>
The computer i'm trying to access is running the play framework. I am receiving the following error:
OPTIONS http://10.0.0.8:9000/demo
404 (Not Found) jquery-1.9.1.min.js:5
XMLHttpRequest cannot load http://10.0.0.8:9000/demo
. Origin http://localhost:8080
is not allowed by Access-Control-Allow-Origin.
I've been stumped now for two days, can anyone help me out?
Thanks ahead
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…