使用JS获取远程页面的HTML内容

问题描述 投票:0回答:1

如何从远程网站提取HTML内容-远程PHP脚本的输出-在不运行Web服务器的情况下由.html文件显示,并且使用纯JS(或Ajax,如果没有, vanillaJS太复杂了。

不能包括https://quarantine.country/coronavirus/cases/usa/输出到covid应用程序(无Apache,仅html)和jQuery太大(!)?

我们需要此输出:

<html><head></head><body>In the US we have 79082 reported cases with 76075 still active. 1864 recovered and 1143 casualties. The death ratio in the US is 0.01 at the moment, 0.02 is recovering. Last update at 2020/03/26.
In the same time, we have 520755 total cases worldwide, with 23581 deaths and 122690 recovered, a 0.05/0.24 ratio.
</body></html>

*用JS加载并包括远程脚本(index.php)的html输出应该可以解决问题。一个简单的解决方案会有所帮助。谢谢!

javascript html post get cross-domain
1个回答
0
投票

首先,您的Web服务器需要返回HTTP标头

© www.soinside.com 2019 - 2024. All rights reserved.