473,499 Members | 1,892 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

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
Dec 10 '07 #1
1 1783
On Dec 10, 10:04 am, "mail...@gmail.com" <mail...@gmail.comwrote:
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.
Dec 10 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
22321
by: petermichaux | last post by:
Hi, In my browser, I make an AJAX request. The server sends me a fragment of an HTML document. That fragment has some JavaScript inside some script tags. How do I run these scripts when the...
31
3070
by: Tony | last post by:
I just noticed that prototype.js is one of the files in the Ajax.NET distribution - I'm pretty concerned about this. Does anyone know if this is the same "prototype.js" that is not well-liked...
3
2752
by: BG Mahesh | last post by:
hi We are looking for a good Ajax library which has very good support for iframe. The ones we have considered so far are, Backbase.com - not happy with the speed Zapatech.com - it is good but...
4
7672
by: ext237 | last post by:
Simple ajax call seems to have some issues in Firefox. The "onComplete:" is called BEFORE the response is returned by the call. Is there a coding issue or a work around? var ajax = new...
3
3112
by: equazcion | last post by:
Hi, I have an image reference (IMG) in my page that changes depending on the value of a database field. Clicking the image triggers an Ajax call to change the database field (toggles the field...
6
5120
by: =?Utf-8?B?U2hhd24gU2VzbmE=?= | last post by:
Greetings! I was researching AJAX to provide a solution to displaying status messages while a long process executed. I found several examples online and was able to use their code to get a quick...
3
2026
by: Mike | last post by:
Hi, I'm wondering if I can do this with ASP.NET?
7
3276
by: Jim in Arizona | last post by:
I'm brand new at ajax. In fact, about 20 minutes ago was the first time I got it to work. The problem I'm having on another page did not work, however. I'm running into the following error: ...
0
7131
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7007
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7174
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7220
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6894
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5470
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
1427
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
665
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
297
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.