我试图创建一个ajax请求,但我没有得到结果。我也在ajax中使用JWT令牌。当使用邮递员的Api我得到200个响应代码,但当我尝试在ajax XMLHttpRequest. No 'Access-Control-Allow-Origin' header is present on the requested resource
$.ajax({
url: 'http://example.com/api/plugins/telemetry/DEVICE/de80d8a0-715e-11e7-a827-c7f326cba909/values/timeseries?keys=ID,V,I,T,SH,SC,ST,Lat,Lon,ERR,CGN',
type: "POST",
dataType: "json",
beforeSend: function (xhr) { //Include the bearer token in header
xhr.setRequestHeader('X-Authorization', 'Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJyYWp1dmNlMDhAZ21haWwuY29tIiwic2NvcGVzIjpbIlRFTkFOVF9BRE1JTiJdLCJ1c2VySWQiOiI3ODVjNmU1MC00Nzg3LTExZTctOTk3MS1jN2YzMjZjYmE5MDkiLCJmaXJzdE5hbWUiOiJSYWphc2hla2hhciIsImxhc3ROYW1lIjoiTSIsImVuYWJsZWQiOnRydWUsImlzUHVibGljIjpmYWxzZSwidGVuYW50SWQiOiI3ODVjMjAzMC00Nzg3LTExZTctOTk3MS1jN2YzMjZjYmE5MDkiLCJjdXN0b21lcklkIjoiMTM4MTQwMDAtMWRkMi0xMWIyLTgwODAtODA4MDgwODA4MDgwIiwiaXNzIjoidGhpbmdzYm9hcmQuaW8iLCJpYXQiOjE1MDMxOTgwMDEsImV4cCI6MTUxMjE5ODAwMX0.VEtikFN2fGkPEt9DA77fmWzGv5Oaw45EFlaZm9AxvXg9sNKIJ2T3qXSlwifm-qSfuTn9ZFP8EbqgXGEp5ImM1g');
},
success: function (data) {
console.log(data)
// STATE OF CHARGE
}
})
我不知道为什么我会得到这个错误。
非常感谢任何帮助。提前致谢
我的邮递员回复