+ Start a Discussion

Returning Apex Object to Javascript

I would like the ability to return an object to my calling Javascript code. Is there a way to do this? What would best practices be? How would the javascript interpret the object (what would I cast it to)?

The use case behind this:
      I have a button that will call the apex webService that I've created. This will modify the org in some way, and return some values (that are not stored in the DB). Based on these values, I'd like my javascript to act in different ways.

Thanks guys.
Best practice would probably be to follow the example on page 142 of the language reference for using the Ajax Toolkit with Apex but instead of setting the value of an id set it to the appropriate object type.