On Wed, Dec 9, 2009 at 1:16 PM, Noah Kantrowitz <[email protected]> wrote: >> -----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 ) >> > Trac uses jQuery internally,
Yes, I know ... RPC plugin too ? > 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) > 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 ...) >> 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 ;o) -- Regards, Olemis. Blog ES: http://simelo-es.blogspot.com/ Blog EN: http://simelo-en.blogspot.com/ Featured article: Depurando errores en aplicaciones web CGI con Python - http://feedproxy.google.com/~r/simelo-es/~3/xxyDHHH1YZ8/depurando-errores-en-aplicaciones-web.html -- 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.
