List Info

Thread: Capture javascript event in CherryPy to execute python function




Capture javascript event in CherryPy to execute python function
user name
2006-12-15 22:32:43
Hi,

Is it possible to have some kind of interface between
cherrypy and
javascript so that I could capture events like 'onClick=...'
?

What I want to accomplish is that a user can click on a
hyperlink and
the click is captured by 'onClick' which then launches some
python code
that does something useful. I do not want to leave the
webpage
(CheeryPy function) I'm currently at at that point.

Anyone any ideas on how to accomplish this?

Thanks,
Regards Otto


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the
Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-usersgooglegroups.com
To unsubscribe from this group, send email to
cherrypy-users-unsubscribegooglegroups.com
For more options, visit this group at http://groups-beta.google.com/group/cherrypy-users?hl=en

-~----------~----~----~----~------~----~------~--~---

Capture javascript event in CherryPy to execute python function
user name
2006-12-15 22:55:58
Otto wrote:
> Is it possible to have some kind of interface between
cherrypy and
> javascript so that I could capture events like
'onClick=...' ?
>
> What I want to accomplish is that a user can click on a
hyperlink and
> the click is captured by 'onClick' which then launches
some python code
> that does something useful. I do not want to leave the
webpage
> (CheeryPy function) I'm currently at at that point.
>
> Anyone any ideas on how to accomplish this?
>   

You need to think about who the players are here. 
"onClick" is running
in the browser.  CherryPy is running in the server.  There
is no connection.

Now, you can certainly have your onClick handler send an
HTTP request
back to your server, and update your web page based on the
results.  
That's the entire principle behind AJAX.

-- 
Tim Roberts, timrprobo.com
Providenza & Boekelheide, Inc.


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the
Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-usersgooglegroups.com
To unsubscribe from this group, send email to
cherrypy-users-unsubscribegooglegroups.com
For more options, visit this group at http://groups-beta.google.com/group/cherrypy-users?hl=en

-~----------~----~----~----~------~----~------~--~---

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )