Reputation: 1208
I am using jQuery.post()
and everything is working just fine, except that the callback function isn't being called.
Data is getting sent properly and the server is receiving it properly etc, but nothing happens afterwards. I have tried copying reference code to no avail.
This is the inline Javascript I'm using:
<head>
<title></title>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
function submit_login_cb(data,status) {
alert(data);
}
function submit_login() {
$.post("http://localhost:8051/", $("#login_form").serialize(), function(data,status){submit_login_cb(data,status);}, "json");
}
</script>
</head>
Why is the callback not working?
Edit: the statusText
field of the returned jqXHR
object just says "error"...Nothing else happens though (the POST request registers on the server).
Edit: Chrome Developer Tools is printing this to the console:
XMLHttpRequest cannot load http://localhost:8051/. Origin null is not allowed by Access-Control-Allow-Origin.
Upvotes: 1
Views: 160
Reputation: 1208
Sorry forgot to update this, to fix this, just allow a Null Origin on your WSGI server.
Upvotes: 1