【发布时间】:2016-11-20 05:21:00
【问题描述】:
我有这个代码:
$.ajax({
url: "http://localhost:15797/api/values",
type: 'get',
contentType: 'application/json',
headers: {
"Authorization": "Bearer " + token
}
})
工作正常,但我想在不使用 Ajax 的情况下做到这一点,我想要这样的东西:
<form action="http://localhost:15797/api/values" method="get">
<input type="hidden" name="headers[Authorization]" value="Bearer token" />
<input type="submit" />
</form>
有可能吗?或者只是在没有 XMLHttpRequest 的情况下做类似的事情?怎么样?
【问题讨论】:
标签: html asp.net-web-api http-headers token