Sat, 08 Oct 2005 11:21:07 -0700 keltezéssel Greg Fischer azt írta:
I would love to have a product (called ZAjax :) that simply receives a request from the client and spits out xml. To be more specific, a set of classes that call ZSQL methods and retrieve records, then send that back in xml format.
We've had this built in to Zope for a long time in the form of XML- RPC. There are several JavaScript libraries that implement an XML- RPC client, the best in my recollection being vcXMLRPC.
or you might also want to have a look at jsonserver2, which is an out-of-the box solution for asynchronous communication between zope and the javascript client. It uses JSON-RPC which is in usage similar to xml-rpc. Basically you map the zope object that produces the dynamic data via url to a javascript method. This method is then called synchronously or used asynchronously via a callback. Whatever the zope object returns, should it be a html snippet rendered out by zpt, or raw data (all python builtin data types and lists, dicts etc) becomes the return value of the remote method. http://www.zope.org/Members/ree/jsonserver2 How you inject the received into your page or manipulate this data afterwards is out of the scope of JSON: you can use your well known libraries for this, or you can use some other functionality of the included JSOLAIT library: it is your choice. Point is, at this point you don't need to parse the received data from XML or whatever: it arrives in a native javascript structure. (Of course you can also generate XML with say, ZPT on the server side, and transfer it as a string, would that be your purpose, but that's usually out of point in this case.) In the above link there are also some simple examples included for your experimentation right away. -- Bala'zs REE' jabber + email: ree@ree.hu ICQ: 75955071 AIM + skype: reebalazs