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

M

maildmz

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
 
D

David Mark

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top