I have one test.html:
<form action="/cgi-bin/test.py" method="GET">
<input type="text" name="search">
<input type="submit" value="Submit">
</form>
<div id="res"></res>
And one python script test.py:
#....
print Result
#....
I want instead of printing result on the test.py, return it to the test.html and write it in the div with id res… How I can do that?
something like that… (this is real hacky 1 minute post that is untested so it may need some work …
your question really has nothing to do with python … it is just web technology question … it would be the same if it was a php or C# or whatever processing the form data
it has nothing to do with python because it doesnt matter how you are processing the form data … this is just web technology it would work exactly the same with a perl script instead of a python script or with a C# instead of python or whatever … you want to return some data back to a web page … how you got the data is really not relevant
here is an example … just paste it into a file.html and go to it and click the button …
its just loading its self
load("")so it should duplicate the data thats on the page when you click it …