1
这是一个有点荒谬的问题,但我如何在jquery中设置多个自定义http头?用jquery设置多个请求头ajax
这样的回答:https://stackoverflow.com/a/14655768/2554598 解释了这样做的像一个标题:
// Request with custom header
$.ajax({
url: 'foo/bar',
headers: { 'x-my-custom-header': 'some value' }
});
这工作。然而,
// Request with custom header
$.ajax({
url: 'foo/bar',
headers: [{ 'my-first-header': 'blub'}, { 'my-second-header': 'peng'}]
});
这会创建一个奇怪的空头字段,其中包含一个json数组。
尝试'头:{“我一首部”:“咕噜咕噜”,“我的秒头”:“鹏”}' –