Django Button Ajax klicken

Ich habe HTML, das Django gut rendert. Ich möchte auf eine Schaltfläche im HTML-Code klicken und dadurch ein Ereignis in der Ansicht auslösen.

Es sieht nicht so aus, als ob der Knopf das verursachtpost feuern. Ich bin mir nicht sicher, was ich falsch mache.

Das ist meinviews.py Code:

def log(request):
  if not request.POST:
    template = loader.get_template('log.html')
    html = template.render(Context())
    return HttpResponse(html)
  print "Post"

Das ist meinlog.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>

Antworten auf die Frage(1)

Ihre Antwort auf die Frage