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

原文地址:https://www.cnblogs.com/robinunix/p/7530519.html