ajax提交数据服务端返回报错

报错如下:

if response.get('X-Frame-Options') is not None:
AttributeError: 'str' object has no attribute 'get'

 

原因如下:

elif request_type == 'ajax':
    print('3333333333')
    return return(json.dumps('6666))

后端返回的时候没有使用HttpResponse

修改:
elif request_type == 'ajax':
    print('3333333333')
    return return HttpResponse((json.dumps('6666)))

 参考:https://stackoverflow.com/questions/22559446/str-object-has-no-attribute-get

posted @ 2017-09-16 10:37  番茄土豆西红柿  阅读(948)  评论(0编辑  收藏  举报
TOP