[Twisted.Web and AJAX](https://stackoverflow.com/questions/3387581/twisted-web-and-ajax)
Similar thread already exits . I even took code from there , yet i have the same problem , the twisted server works like a charm, but can't figure out why i can't fetch it with ajax. In similar thread he says that alert comes out , but without data. For me even alert doesn't pop up , yet another ajax functions works , so in general with ajax is everything ok , but exactly with fetching something goes wrong. 

As also said in similar thread i can fetch it with curl - `$ curl --url http://localhost:8082/test -v` , and it shows hello world , so servers works fine 100 % .

Any ideas ?

```
<script type="text/javascript">
// Submit button
$(function(){
  $.ajax({type: "POST", 
     $('a').click(function(){
        url: "http://localhost:8082/test",
        data: {},
        success: function(data) {alert("Success:" + data);}
    });
  });
});
</script>

<html>
[...]
  <a href="#">Load Favorites Movies</a>...
[...]
</html>

```

**server.py**

```
from twisted.web import server, resource, http

class RootResource(resource.Resource):
    def __init__(self):
        resource.Resource.__init__(self)
        self.putChild('test', TestHandler())

class TestHandler(resource.Resource):
    isLeaf = True

    def __init__(self):
        resource.Resource.__init__(self)
    def render_GET(self, request):
        return self.render_POST(request)
    def render_POST(self, request):
        return "hello world!"

if __name__ == "__main__":
    import sys
    from twisted.internet import reactor
    reactor.listenTCP(8082, server.Site(RootResource()))
    reactor.run()

```

---

Big thank you to **Peter Le Bek** and **Darkporter**.
Peter Le Bek asnwer marked as correct , and Darkporter vote up =) from me .

Answer : Peter's answer works out of the box , just the thing that confused me a little bit was the line , where you had to specify the static folder. It is easy ... just sepcify any folder there , put there index.html and it will a root directory , when you access it on the web.