maildmz-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Dec-10 18:13 UTC
Ajax Response events do not fire , using Mongrel with Ruby and Prototype.
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
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---