[mod_python] Re: Events

StianSøiland stian at soiland.no
Sat Apr 17 00:17:43 EST 2004


On 2004-04-16 22:07:22, Robert Thomas Davis wrote:

> I am interested in staying away from javascript if possible so I was
> wondering how one would go about calling server side python functions
> from page events...like OnClick.

Include a small picture of 1x1 transparent pixel somewhere unnoticable:

  <div class="footer">
    adlkasdlk asda sd (c) 8123932
    asdlaksdl. 
    <img src="blank.png" width="1" height="1" id="actionimg" />
  </div>  

Then from javascript - change the url of "actionimg" to
"/?my_request.py/method?askdjasdlkjakjsd". You won't be able to receive
anything useful though, so this could be used to change some internal
server state.

You COULD return some other picture and use that as some information
flow to the user. For instance, you could change the color of some image
according to the internal web server state - by just changing to some
method that returns the other image.

-- 
Stian Søiland               Work toward win-win situation. Win-lose
Trondheim, Norway           is where you win and the other lose.
http://www.soiland.no/      Lose-lose and lose-win are left as an
                            exercise to the reader.  [Limoncelli/Hogan]
                            Og dette er en ekstra linje 



More information about the Mod_python mailing list