$.ajax({
url: 'http://example.com/api',
type: 'post',
dataType: 'json',
data: { // 请求数据
key: 'value'
},
success: function(resp) {
console.log(resp); // 打印返回数据
},
error: function(xhr, status, error) {
console.log(error);
}
});