我有一个函数,用于发送HTTP POST请求,我想为调试目的记录它。以下是该函数:
function serverRequest(URL, DATA, callback) {
$.ajax({
url: URL,
type: "POST",
dataType: "text",
contentType: "text/xml",
processData: false,
data: DATA,
success: function (response) {
console.log(response);
callback(response);
},
error: function (response) {
console.log(response);
callback(null);
}
});
}
如何在 HTTP POST 请求发送时记录整个请求(包括 HTTP 标头 + 数据)?
谢谢。