What's the very simplest way to run some Python from a button on a web page?

Ian Kelly ian.g.kelly at gmail.com
Sat Jan 21 13:44:08 EST 2012


On Sat, Jan 21, 2012 at 7:58 AM, <tinnews at isbd.co.uk> wrote:

> I want to run a server side python script when a button on a web page
> is clicked.  This is on a LAMP server - apache2 on xubuntu 11.10.
>
> I know I *could* run it as a CGI script but I don't want to change the
> web page at all when the button is clicked (I'll see the effect
> elsewhere on the screen anyway) so normal CGI isn't ideal.
>
> It's easy to show a button:-
>
>    <INPUT TYPE=submit NAME="Button" ONCLICK=something>;
>
> Can I get away with something clever for 'something' that will somehow
> hook through to a server side script?
>

Yes, use AJAX to make an asynchronous request.  There are several AJAX
toolkits out there that will make this simple.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20120121/e31ada9a/attachment-0001.html>


More information about the Python-list mailing list