我有一个发送 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 标头 + 数据)?
Thanks.
寻找标签“Network" (not the Console如果您使用的是 Chrome,请在开发人员工具 (Ctrl+Shift+J) 上打开选项卡);如果您使用的是其他浏览器,则使用类似的选项。
即使在那之后,如果您想记录 XHtmlRequest,您始终可以这样做(如果您的浏览器支持 console.log):
var xhr = $.ajax(...);
console.log(xhr);
希望我有所帮助。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)