我正在尝试通过 Ajax 调用返回 html,并且在我的视图中有以下代码片段
if request.is_ajax():
t = loader.get_template('frontend/scroll.html')
html = t.render(RequestContext({'dishes': dishes})
return HttpResponse(json.dumps({'html': html}))
和我的阿贾克斯
$.ajax({
type: "POST",
url: "/filter_home",
data: {'name': 'me', 'csrfmiddlewaretoken': '{{csrf_token}}'},
success : function(data) {
$('.row.replace').html(data);
}
});
它会引发以下错误
Exception Value: 'dict' object has no attribute 'META'
Exception Location: /opt/bitnami/apps/django/lib/python2.7/sitepackages/django/core/context_processors.py in debug, line 39
我究竟做错了什么?