I am learning the JQuery Get method. I start up a Python HTTP server:
(just typing command "Python -m SimpleHTTPServer").
It's fine to test this webserver by just visiting "http://localhost:80" on my web browser. However, when I write this very simple javascript to visit my webserver. I get an error message:
"code 501, message Unsupported method ('OPTIONS')"
I use jquery.xdomainajax.js library which suppose cross domain request JQuery.
Here is my javascript code:
<html>
<head>
<script src="jquery.min.js"></script>
<script src="jquery.xdomainajax.js"></script>
<script type="text/javascript">
$(document).ready(function(){
u = 'http://localhost:80';
jQuery.get(u, function(res){
$("#data").html(res.responseText)
});
});
</script>
</head>
<body>
<p id="data"></p>
</body>
</html>
Actually, if I change u to any other url, such as "http://www.google.ca". It works quite well. But I have no idea why it does not work for the basic Python HTTP server. Can anyone help me?