Ruby and ajax

I have a problem with a ruby script, it doesn't work if I call from a ajax method.
The script is:

  #!/usr/bin/ruby -w

require 'proxy1LDAP'
require 'cgi'

cgi = CGI.new
account = cgi.params

puts "Content-type: text/plain"
puts

acc=Proxy1LDAP.new
acc.connetti
acc.inserisci(account)
acc.disconnetti

If I call from action method of a form it works, but if I call from:

xmlHttp.open("POST", "/cgi-bin/ruby/accMail1.rb", true);
xmlHttp.onreadystatechange = handleStateChange;
xmlHttp.setRequestHeader("content-type", "application/x-www-form-urlencoded");
xmlHttp.send(
   "uid=" + escape(field['uid']) +
   "&nome=" + escape(field['nome']) +
   "&cognome=" + escape(field['cognome']) +
   "&codice=" + escape(field['codice']) +
   "&password=" + escape(field['password'])
);

passing parameters through send method.
It doesn't work.

Use firebug to inspect what is actually being transmitted and you get
a valid reply, etc. Also, check to make sure that CGI isn't masking
param varaibles sent via the QUERY_STRING since it is a POST request
(this might be the default behavior?)

Paul Stickney wrote:

Use firebug to inspect what is actually being transmitted and you get
a valid reply, etc. Also, check to make sure that CGI isn't masking
param varaibles sent via the QUERY_STRING since it is a POST request
(this might be the default behavior?)

What is firebug?
Anyway now the script works but I don't have any responseText.
Ajax function is:

.....
function handleStateChange() {
   if(xmlHttp.readyState == 4 && xmlHttp.status == 200) {
     document.getElementById("log").innerHTML = xmlHttp.responseText;
   }
}

the script is

require 'proxy1LDAP'
require 'cgi'

cgi = CGI.new
account = cgi.params

acc=Proxy1LDAP.new
acc.connetti
acc.inserisci(account)
acc.disconnetti
cgi.out("text/plain") do
   "prova"
end

I expect the string "prova" as a responseText, the script works fine but I don't have any responseText.
Is a script problem?