本文共 398 字,大约阅读时间需要 1 分钟。
和网上其它用JAVA或是PHP的实现不太一样,
DJANGO中的解决办法如下:
后端样例:
def render_to_json_response(context, **response_kwargs): data = json.dumps(context, ensure_ascii=False, indent=2) response_kwargs['content_type'] = 'application/json' return HttpResponse(data, **response_kwargs)
前端样例:
error: function (jqXHR, textStatus, errorThrown) { UIkit.modal.alert(jqXHR.responseText); },
出来的样子:
转载地址:http://bttkx.baihongyu.com/