# Ajax Response events do not fire , using Mongrel with Ruby and Prototype

**URL:** <https://www.ruby-forum.com/t/ajax-response-events-do-not-fire-using-mongrel-with-ruby-and-prototype/122675>\
**Category:** Ruby\
**Created:** [December 10, 2007, 4:05pm UTC](https://www.ruby-forum.com/t/ajax-response-events-do-not-fire-using-mongrel-with-ruby-and-prototype/122675 "2007-12-10T16:05:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [December 10, 2007, 4:05pm UTC](https://www.ruby-forum.com/t/ajax-response-events-do-not-fire-using-mongrel-with-ruby-and-prototype/122675/1 "2007-12-10T16:05:54Z")

</div>

Goodafternoon,

I have got a minimum Mongrel instance running (see ruby code) and i am  
hitting it with an Ajax request using Prototype. (see javascript code)

I get the ‘onLoading’ event, but the other events never fire. I am  
getting the response because I can see the response from the Mongrel  
server in my net monitor (Firebug). But the events itself never fire  
(no oncomplete and or onfailure)

Can anyone see what I am doing wrong?  
Do I need to add something more to the header in Mongrel?

Also i’m using the cross site ajax plugin to do cross Site Ajax calls.  
(hence the crossSite:true) and trace does a write to the firebug  
console.

Thank you very very much  
kind regards,  
Marco Kotrotsos

* * *

//Javascript

function request() {

```
    trace('start');
    new Ajax.Request('http://localhost:3000/test', {
      method: 'GET',
      crossSite: true,

              onLoading: function(transport) {
              trace('onLoading' );
              },
              onComplete: function(transport) {
              trace('onSuccess');
              trace('The message is '+message);
              },
              onFailure: function() {
              trace('onFailure');
              }

```

});  
}

//ruby

class SimpleHandler \< Mongrel::HttpHandler  
def process(request, response)  
response.start(200) do |head,out|  
head[“Content-Type”] = “text/javascript”  
out.write(“var message = ‘hello’;\n”)  
end  
end  
end

h = Mongrel::HttpServer.new(“127.0.0.1”, “3000”)  
h.register("/test", SimpleHandler.new)  
h.run.join
