目录

工欲善其事

实践出真知

活跃标签: linux java mysql 待分类 js springboot win10 电路 vue macOS nginx esp32 windows git docker idea maven esp8266 python Arduino

存档:

X

接口是否支持跨域测试

Ajax方式

var xhr = new XMLHttpRequest();
xhr.open('GET', 'http://localhost:8888/api/kernels');
xhr.send(null);
xhr.onload = function(e) {
    var xhr = e.target;
    console.log(xhr.responseText);
}

Fetch方式

fetch(`http://localhost:8888/api/kernels?${new Date().getTime()}`, {method: 'get'}).then(res => console.log(res))

标题:接口是否支持跨域测试
作者:llilei
地址:http://solo.llilei.work/articles/2021/12/11/1639207098191.html