📜  从承诺值获取重定向到网站 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:04:13.285000             🧑  作者: Mango

代码示例1
fetch("http://example.com/", {
    method: 'POST',
    mode: 'cors',
    body: formData
})
.then(dataWrappedByPromise => dataWrappedByPromise.text())
.then(data => {
    //Redirect is the URL inside the text of the response promise
    window.location.replace(data);
})