I use Ajax Push Engine as push engine and Django for main site. I wrote the server module which must send the request to my Django-based application when new user join the channel by using Http module. My Django-based project runs on the local machine on local.jjjbbb.org.
Ape.addEvent("join", function(user, channel) {
var request = new Http('http://local.jjjbb开发者_运维知识库b.org/test-
this/'); // this is a my test url
request.set('method', 'POST');
request.writeData('test-message', 'Hello APE!');
request.getContent( function(result) {
Ape.log(result); // this code never work
});
});
But this code doesn't work, request doesn't receive. When I change url to anything else (like www.google.com or localhost for example) all works correctly and I have a result. But when I try to send request to my application request doesn't work. This problem is only when I try to send request from server side, when I use jQuery for sending from client side all works correctly.
Why I cannot send POST request from server side to my domain?
Sorry, I already found my problem. APE works fine, it was a little trouble with CSRF protection in Django.
精彩评论