DjangoがうまくレンダリングしているHTMLがいくつかあります。HTMLのボタンをクリックして、ビューでイベントを発生させたいのですが。
post
ボタンが発火しているようには見えません。何が間違っているのかわかりません。
これは私のviews.py
コードです:
def log(request):
if not request.POST:
template = loader.get_template('log.html')
html = template.render(Context())
return HttpResponse(html)
print "Post"
これは私のlog.html
です:
<!DOCTYPE html>
<html>
<head>
<title></title>
<script type="text/javascript">
$("#update_log_button").bind("button", function(){
$.post("hello");
return false;
});
</script>
</head>
<body>
<p>
<span>SPHIINX Log</span>
</p>
<p>
<textarea cols="2" name="log" rows="25"></textarea>
<input id="update_log_button" name="update_log" type="button" value="Update Log"/>
</p>
</body>
</html>