和网上其它用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);
            },

出来的样子:

DJANGO中,用QJUERY的AJAX的json返回中文乱码的解决办法

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-09
  • 2022-12-23
  • 2022-12-23
  • 2021-12-17
猜你喜欢
  • 2021-12-07
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-19
相关资源
相似解决方案