私のサーバーは、成功すると「HttpResponse()を返します」、失敗すると「HttpResponse(status = 400)を返します」。私のクライアントには、次の jquery ajax 関数があります。
$('#submit').click(function(){
$.post("{% url 'addcomment' %}", {msg:$('#newcomment').val()}, function(data,status){
if (status==200) {
location.reload()
} else {
alert("Comment failed")
}
});
});
しかし、ajax コードは機能しません。何か案が?