您可以使用 encodeURIComponent() 函数将中文参数编码,然后将其添加到 URL 中作为查询字符串。

例如:

var chineseParam = '中文参数';
var url = 'http://example.com/api?param=' + encodeURIComponent(chineseParam);

$.ajax({
  url: url,
  method: 'GET',
  success: function(response) {
    // 处理响应
  },
  error: function(error) {
    // 处理错误
  }
});

在服务器端,您需要解码查询字符串来获取中文参数的原始值。

使用 jQuery AJAX 获取中文参数

原文地址: https://www.cveoy.top/t/topic/nypw 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录