1
当我遇到困难时,我的服务器“返回HttpResponse()”,失败时返回“HttpResponse(status = 400)”。 我的客户有以下的jQuery AJAX功能:如何使用jQuery获取django的HttpResponse状态码?
$('#submit').click(function(){
$.post("{% url 'addcomment' %}", {msg:$('#newcomment').val()}, function(data,status){
if (status==200) {
location.reload()
} else {
alert("Comment failed")
}
});
});
但AJAX代码不起作用。任何想法?
的可能重复[如何从jQuery.ajax获取响应状态代码?](http://stackoverflow.com/questions/5344145/how-to-get-response-status-code-from-jquery-ajax) – 2013-04-25 08:47:23