Javascript + Python...

Jim jim at publishingresources.com
Wed Jul 18 11:58:32 EDT 2001


Vincent A. Primavera <vincent_a_primavera at netzero.net> wrote in
<mailman.995037983.15466.python-list at python.org>: 

> Hello,
>      Does anyone know if there are ways to have JavaScript(client
>      side...) 
> "communicate" with Python(server side...) via variables(environmental?)
> etc...?
> 
>      Thank you,
>      Vincent A. Primavera
> 

Well I'm not quite sure what you are asking, but here's something I did the 
other day.

I have an javaScript event load a new Image while passing a slide # to the 
server.

function addslide(id) {
	now = new Date();
	var a = new Image()
	a.src = "/presentations/browse/addslide.asp?newslide=" + id + "&now=" 
+ now.getTime()
	a = null
}

This way I can tell the server to store information from the webpage by the 
user simply clicking a checkbox or image or any other javascript event.

This idea could be modified to get information back to the page as well, you 
could create a frame or open an invisible window and get data from the 
server and use Javascript to do something with it on the page without 
refreshing.

Note that above the now param is needed to stop caching.

Hope this helped,

J



More information about the Python-list mailing list