ajax to get data Chinese garbled problem the simplest perfect solution _AJAX related _ script home

ajax is the simplest and perfect solution to the problem of garbled data

Updated: Nov 24, 2014 15:31:58 Submitted by: hebedich
This article mainly introduces ajax to obtain data Chinese garbled code problem the simplest perfect solution, need friends can refer to the next

Use scriptCharset to solve the problem, but not necessarily contentType.

Copy codeThe code is as follows:

$.ajax({
      url: testUrl,
      dataType: 'jsonp',
      type: 'post',
      scriptCharset: 'utf-8'
    });

The above solution is the most perfect, and there is also an online solution, which is handled with contentType

Copy codeThe code is as follows:

jQuery(form).ajaxSubmit({
url: "ajax.aspx? a=memberlogin",
type: "post",
dataType: "json",
contentType: "application/x-www-form-urlencoded; charset=utf-8",
success: showLoginResponse
});

Although it can be used, it is not recommended for everyone.

Related article

  • ajax三级联动的实现方法

    ajax three level linkage implementation method

    This article mainly introduces the implementation method of ajax three-level linkage in detail for everyone, and has certain reference value, interested partners can refer to it
    2017-03-03
  • Ajax返回数据之前的loading等待效果

    The loading wait effect before Ajax returns the data

    We pass parameters to the background through ajax request, and then the background returns data to the front desk after a series of operations. I hope that a loading.gif image can be displayed before waiting for the successful return of data. Next, through this article to share the loading waiting effect before Ajax returned data, the need of friends can refer to it
    2017-08-08
  • 5款Ajax 文件上传控件

    5 Ajax file upload controls

    If your website has file upload capabilities, you can use the five Ajax file upload controls introduced in this article to improve the user experience. You know, uploading files is always a painful process, and it's not realistic to eliminate it, but at least if you make an effort to reduce the pain for users, then users will love your site.
    2009-10-10
  • Ajax 网址备忘

    Ajax URL memo

    Ajax URL Memo...
    2006-06-06
  • 探讨Ajax中的一些小问题

    Explore some minor issues in Ajax

    In the process of using ajax often encounter a variety of problems, today Xiaobian to share some small problems in ajax, more practical, interested friends can refer to
    2016-05-05
  • Ajax长连接项目案例

    Ajax long connection project case

    The so-called long connection, is to continue to send requests, the request is blocked in the server side, each time more than the request time to re-send the request, the following is an example for everyone to introduce in detail, interested friends do not miss it
    2013-08-08
  • 如何使用ajax读取Json中的数据

    How do I use ajax to read data in Json

    This article mainly introduces how to use ajax to read the data in Json, how to use AJAX to read the data in Json array, interested partners can refer to it
    2016-04-04
  • 如何解决远程页面抓取中的乱码问题

    How to solve the problem of garbled characters in remote page crawling

    How to solve the problem of garbled characters in remote page crawling...
    2006-12-12
  • ajax传递一个参数具体实现

    ajax passes a parameter to the concrete implementation

    ajax to pass a parameter or more parameters in the process of use due to special needs often used, the following to share with you the specific implementation method, interested friends can refer to the next ha
    2013-05-05
  • Ajax基础使用详解

    Detailed use of Ajax basics

    This article mainly introduces the basic use of Ajax detailed explanation, is the ability of front and back end interaction, that is, our client to send messages to the server tool, and accept the response tool, this article to explain the basis of ajax in detail, the need of friends can refer to
    2023-05-05

Latest comments