后端返回html代码,如何重定向到一个临时页面,将后端返回的html代码插入其中?

后端返回html代码,如何重定向到一个临时页面,将后端返回的html代码插入其中?

重定向到window.location.href = ‘about:blank’,
将后端返回的html写入页面documen.write(res)

重定向 就可以 用 路由跳转 window.location.href

至于返回的 html 可以用 innerHtml 属性 插入进去

const div = document.createElement("div");
div.innerHTML = res.data;
document.body.appendChild(div);
document.forms[0].submit();

五毛钱的架构师。。。

前后端分离的话,JSON特别好弄。

若是没分离,基本都是后端传递全部的HTML。