Ajax requests are by definition asynchronous. You must use alert your
value from *inside* your callback, like so:
function JSON_REQUEST()
{
new Ajax.Request('process.php?mode=json', { method:'get', onSuccess:
function(transport){
alert(transport.headerJSON)}
});
}
Also I suggest you drop using the second argument to your callback,
and use the new headerJSON property instead, as the former has been
deprecated.
More details here: http://prototypejs.org/api/ajax/response
Best,
Tobie
On Dec 24, 2:52 am, Aea <[EMAIL PROTECTED]> wrote:
> Response Headers...
>
> Date Mon, 24 Dec 2007 01:51:26 GMT
> Server Apache/2.0.59 (Unix) PHP/5.2.5 DAV/2
> X-Powered-By PHP/5.2.5
> Expires Thu, 19 Nov 1981 08:52:00 GMT
> Cache-Control no-store, no-cache, max-age=0, must-revalidate
> Pragma no-cache
> X-JSON {"a":1,"b":2,"c":3,"d":4,"e":5}
> Content-Length 0
> Keep-Alive timeout=15, max=78
> Connection Keep-Alive
> Content-Type text/html
>
> As generated by Firebug. There's no issue displaying the JSON object
> if I try to within that onSuccess function, but I can't export that
> object.
--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---