gpt4 book ai didi

Javascript/jquery 从另一个页面加载特定的 div

转载 作者:行者123 更新时间:2023-11-28 18:18:43 25 4
gpt4 key购买 nike

我正在尝试从不同的网页加载特定的 div。

<div id="result">Loading</div>

<script>
$( "#result" ).load("http://bte.gep.msess.gov.pt/pesquisa_avancada.php #boxinterior" );
</script>

我已经尝试过使用 jquery 和 javascript,但它不能正常工作,因为它应该。有什么想法吗? #boxinterior 是来自其他网站的 div。

编辑

它没有按应有的方式向我显示 div,并且给了我一个

XMLHttpRequest cannot load http://bte.gep.msess.gov.pt/pesquisa_avancada.php. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.

最佳答案

根据您的编辑,出于安全原因,您不得在客户端加载来自其他域的内容。

如果您希望将该内容注入(inject)到您的页面中,您应该在服务器端加载它并将其包含在响应中。

关于Javascript/jquery 从另一个页面加载特定的 div,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40342723/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com