jQuery.ajax()记录HTTP请求

我有一个发送HTTP POST请求的函数,我想记录它以进行调试。 这是function:

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标头+数据)?

谢谢。

如果您使用的是Chorme,请在开发人员工具(Ctrl + Shift + J)上查找“ 网络 ”( 不是 控制台选项卡)选项卡,如果您使用的是其他浏览器,则查找类似的选项卡。

即使在那之后,如果你想记录XHtmlRequest,你总是可以做(如果你的浏览器支持console.log):

 var xhr = $.ajax(...); console.log(xhr); 

希望我能帮到你。