下が自分で考えてみたコードなのですが実行すると、
Uncaught TypeError: req.addEventListner is not a function
POST http://************/test.py 405 (Method Not Allowed)
というエラーが出てしまいます。どのあたりが間違っていますでしょうか?
jquery
1$(function(){ 2 $.ajax({ 3 url: 'recieve.py', 4 type: 'post', 5 data: '送信メッセージ' 6 }).done(function(data){ 7 console.log(data); 8 }); 9 }).fail(function(){ 10 console.log('failed'); 11 }); 12});
javascript
1function test(){ 2 var req=new XMLHttpRequest(); 3 req.open("post","../test.py",true); 4 req.send("test"); 5 req.addEventListner("load",function(){ 6 console.log(this.response); 7 },false); 8};