> -----Original Message----- > From: [email protected] [mailto:[email protected]] > On Behalf Of Olemis Lang > Sent: Wednesday, December 09, 2009 10:51 AM > To: [email protected] > Subject: Re: [Trac] How to use Ajax + Python. > > On Wed, Dec 9, 2009 at 1:16 PM, Noah Kantrowitz <[email protected]> > wrote: > >> -----Original Message----- > >> From: [email protected] [mailto:trac- > [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 ) > >> > > Trac uses jQuery internally, > > Yes, I know ... RPC plugin too ?
No, the XmlRpcPlugin is a 3rd-party tool. > > > so you are by no means required to use it but > > it is available if you want (and I would personally recommend it). > > I do it for widgets and so on . For RPC I prefer a single lib I can > use with no matter what framework I selected to build the site ;o) > > > Doing an > > AJAX GET request is very simple, just create an IRequestHandler so > provide > > whatever data you want. > > Correct, that's how the browser is implemented and using a special > HTTP header (isn't it ?) > > An RPC handler would simple as well > ;o) If using the plugin, yes, this would be option as well. > > > 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. > > > > Another reason for using RPC (transparency ...) Using XML-RPC doesn't improve transparency, it just entirely sidesteps the issue by not using the XSRF protection system. > > >> 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 > > > > When I mentioned this I wanted to say that if you want to access the > same data and make it accessible to code written in a programming > language other than JavaScript then it is possible to use XML (JSON) > RPC just by performing regular method calls on proxy objects jQuery has no such system for doing proxy calls that I know of, and while I can't comment on every language, C and C++ certainly don't. Python does, but this is by no means a reason to use XML-RPC to the browser. --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.
