If you're using the Ajax.Request object, then you can use the second
parameter of the callback function. However, you have to specifiy the
x-json header on the server with a value of your json object. I
suspect, that somewhere in the prototype code, all it's doing is an
eval() of the x-json header, but it obfuscates those details from the
code.
For example, in PHP, instead of simply echoing
{"Success":true,"Success_message":"Yeah!"} you would say:
header("x-json", '{"Success":true,"Sucess_message":"Yeah!"}');
Then, you callback function could do something like this:
function callback(response, json) { if(json.Success)
alert(json.Success_Message) }
Does that help?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---