passing value from html to python using django -
i have html page consists of tables . need send id of cells python whenever user clicks on 1 of cells : here's code i've used of :
############the html file:(search.html)
<body> <button type="button" action="/hello/" onclick="/hello/">try it</button> <table width="1000" table border="3"> <tr> <td ><div id="0" onclick="parent.location='{% url "view.search :request,454 " %}'">copy text</div></td> <td>hell</td> </tr> <tr> <td ><div id="1" onclick="copytext(id)">copy text</div></td> <td>hell</td> </tr> <tr> <td ><div id="2" onclick="copytext(id)">copy text</div></td> <td>hell</td> </tr> <table> </body>
########## python views file in django : def search(request,c): print "clicked" print c return render(request, 'search.html')
Comments
Post a Comment