[EMAIL PROTECTED] schrieb:
> It appears loadJSONDoc("http://somedomain.org/somemethod") is
> good/best AJAX way to get data from a TurboGears server....
>
> ** Should /somemethod be a controller with @expose("json") to return
> JSONified Python dictionaries?
>
> ** What is good/best AJAX/MochiKit function to *send* data to
> server??
The version of MochiKit shipped with TurboGears seems to lack a
low-level function to do POST requests. Try MochiKit from SVN and look
at the "doXHR" function:
http://mochikit.com/doc/html/MochiKit/Async.html#fn-doxhr
Just do a POST request to a normal TG controller method.
> ** Is there any advantage to sending data to server as JSON objects?
> (I don't see how that will work since controllers aren't set up to receive
> JSON objects.)
Depends on what kind of data you want to send. If it's just simple
string values, a normal www-url-encoded POST request should do. If you
want to send complex objects, you need to encode your data in some way
on the client side and JSON is a natural choice for this.
Chris
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" 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/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---