$.ajax({ type: \'POST\', url: "URL", contentType:\'application/json\', //需要加contentType crossDomain: true,// 开启跨域支持 data: JSON.stringify({ A:\'a\', B:\'b\' }), //数据对象必须使用JSON.stringify转换成字符串,直接传对象会有问题 dataType: \'json\', // 服务器响应的数据类型 async: false, // 关闭异步 success: function(rec) { console.log(rec) } });
其它更详细的介绍,可以参见 :https://www.cnblogs.com/jaxu/p/3698404.html