> -----Original Message----- > From: [email protected] [mailto:[email protected]] > On Behalf Of Olemis Lang > Sent: Wednesday, December 09, 2009 6:21 AM > To: [email protected] > Subject: Re: [Trac] How to use Ajax + Python. > > On Wed, Dec 9, 2009 at 9:12 AM, prabhakar <[email protected]> > wrote: > > Hi, > > > > How can we perform ajax + python operations, i have few queries > > related to Ajax+python listed bellow, > > > > 1. Once we send the request( Data) to python , how can we send back > > the response to Javascript from python. > > 2. Is there any packages are required to perform Ajax+Python > > operations ? , if yes please mentioned those packages. > > > > In fact there are many ways to get this done. My favorite is to > implement RPC handlers (XmlRpcPlugin ;o) and execute them using > JSON-RPC (i.e. JSON output) from JavaScript. In order to do this you > should be able to use jQuery RPC plugin (I don't use it , last time I > tried was buggy :-/ ) or another project -the one I use- hosted by > Google Code (don't remember it's name , please search ) > > The added benefit is that you can also perform the same calls from > other environments (outside Javascript ;o) and just need to implement > things once
Trac uses jQuery internally, so you are by no means required to use it but it is available if you want (and I would personally recommend it). Doing an AJAX GET request is very simple, just create an IRequestHandler so provide whatever data you want. Making something to do POSTs is a bit harder since you need to figure out how to include the XSRF form token in the request. --Noah -- You received this message because you are subscribed to the Google Groups "Trac Users" 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/trac-users?hl=en.
