首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >通过Ajax返回呈现的Html

通过Ajax返回呈现的Html
EN

Stack Overflow用户
提问于 2013-09-24 16:17:01
回答 3查看 24.4K关注 0票数 20

我正在尝试通过和Ajax调用返回html,在我的视图中有以下代码片段

代码语言:javascript
复制
if request.is_ajax(): 
t = loader.get_template('frontend/scroll.html')
html = t.render(RequestContext({'dishes': dishes})
return HttpResponse(json.dumps({'html': html}))

和我的Ajax

代码语言:javascript
复制
  $.ajax({
           type: "POST",
           url: "/filter_home", 
           data: {'name': 'me', 'csrfmiddlewaretoken': '{{csrf_token}}'},
           success : function(data) {
                $('.row.replace').html(data);
            }
   });

并抛出以下错误

代码语言:javascript
复制
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

我做错了什么?

EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/18976302

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档