Connecting Tech Pros Worldwide Forums | Help | Site Map

Ajax Response events do not fire , using Mongrel with Ruby andPrototype.

maildmz@gmail.com
Guest
 
Posts: n/a
#1: Dec 10 '07
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

David Mark
Guest
 
Posts: n/a
#2: Dec 10 '07

re: Ajax Response events do not fire , using Mongrel with Ruby andPrototype.


On Dec 10, 10:04 am, "mail...@gmail.com" <mail...@gmail.comwrote:
Quote:
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)
>
You should ask in the Ruby spin-offs group.
Closed Thread